Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Place abstractions and the classes that implement them in separate modules.
Providing new implementations of the abstractions within a module allow you to create new modules with implementations that extend the behavior of the system. Abstract Modules accommodates this scenario. However, in certain situations, you may want to replace an existing behavior of the system with new behavior altogether. Unfortunately, with Abstract Modules, the abstractions and implementations live within the same module, preventing you from replacing the default behavior.
Abstract Modules pattern, 222
By separating the abstractions from the implementations, placing each in different modules, you allow yourself the flexibility to provide new implementations that completely replace the existing implementation. Figure 11.5 illustrates Separate Abstractions. The Service interface and ServiceImpl are placed in separate modules. New service implementations can be created and placed in their own modules, allowing you to remove any existing service implementations without modifying the existing system.