Single Responsibility Principle (SRP): The interface or data conversion code can be separated from the application’s primary business logic.The Adapter class implements the Target interface but internally uses an instance of the Adaptee to make its functionality available to the Client. In other words, the Adaptee is the class that needs to be adapted. The Adaptee is some useful class (usually 3rd-party or legacy) that has the functionality the Client wants to use but is incompatible with the Client‘s interface. The Target interface describes a protocol that the Client code expects to work with. The Client is a class that contains some existing business logic for the application. The UML diagram for the Adapter Structural Design Pattern The implementation of an Adapter class uses the object composition principle: the adapter implements the interface of one object and wraps the other one. How does the Adapter Design Pattern work?
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |