Design Patterns Explained: A New Perspective on Object-Oriented Design
by Alan Shalloway, James R. Trott
Find What Is Varying and Encapsulate It
In Design Patterns: Elements of Reusable Object-Oriented Software, the Gang of Four suggests the following:
Consider what should be variable in your design. This approach is the opposite of focusing on the cause of redesign. Instead of considering what might force a change to a design, consider what you want to be able to change without redesign. The focus here is on encapsulating the concept that varies, a theme of many design patterns.[1]
[1] Gamma,E.,Helm,R.,Johnson,R.,Vlissides,J.,Design Patterns:Elements of Reusable Object-Oriented Software, Reading,Mass.:Addison-Wesley,1995,p.29.
[1] Gamma,E.,Helm,R.,Johnson,R.,Vlissides,J.,Design Patterns:Elements of Reusable Object-Oriented Software, Reading,Mass.:Addison-Wesley,1995,p.29. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access