Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
mailbox-store module aims at sharing code between mailbox implementations.
To Achieve that, it relies on inheritance and a level of abstraction, namely Mappers.
This design promotes code sharing as a way to share behaviors of Managers implementation.
This strategy is brittle because there's no way to ensure that inheriting a class will define its behavior.
In James, we usually define Contract TestSuites to ensure that the implementation of an interface behaves as expected, Managers are an exception to this rule.
Also, the use of the Mapper layers offer very weak guarantees and at the same time constrains the way we implement Managers.
Dropping the mapper layer would help simplify the codebase.
So the plan is to push methods down in all implementations, remove abstract classes, inline Mappers in Managers and port relevant Mappers tests to Managers level.
Some efforts to reduce duplication generated by pushing methods down the hierarchy will lead to new helper classes to share between classes or enriching existing APIs for a higher level of abstraction.