Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

11. Extensibility Patterns > Separate Abstractions

Separate Abstractions

Statement

Place abstractions and the classes that implement them in separate modules.

Description

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.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial