I am interested to know which GoF design pattern translates directly to a specific SOLID principle? Like for instance I think (in my opinion) the strategy pattern translates to the Dependency-Inversion Principle.
Unfortunately, I could not find any literature that examines their relationships. It would be nice to have to learn both more effectively with each others perspectives.
- I'm quite satisfied by the answer in this old post,stackoverflow.com/questions/412914/…Ronald– Ronald2011-09-14 18:45:32 +00:00CommentedSep 14, 2011 at 18:45
- This webinar in InfoQ particularly discusses this topic,infoq.com/presentations/…Ronald– Ronald2011-09-16 12:22:37 +00:00CommentedSep 16, 2011 at 12:22
3 Answers3
SOLID principles are applied in most of GoF's design patterns.
- S: Single responsability principle: the classes that are part of theDP, have only one responsability
- O: Open/Closed principle: it is easyto extend with new functionality, for example the strategy patternallows you to implement an additional algorithm without having tochange the other classes that contain other algorithms
- Liskov Substitution Principle: also applies to strategy for instance
2 Comments
GOF are patterns i.e. proven design solutions to recurring problems. SOLID are principles and are not tied to any specific problem domain hence true in any scenario
1 Comment
There's a paperA reference model for low level design, which lists the SOLID properties for some patterns in table 3:
- Facade: ISP, DIP
- Chain of Responsibility: SRP, OCP, LSP, ISP, DIP
- Decorator: SRP, OCP, LSP, ISP, DIP
- Factory: SRP, OCP, ISP, DIP
- Builder: SRP, ISP, DIP
- Adapter: SRP, ISP, DIP
I'd like to see such research for all patterns, but I'm not aware of similar papers.
Comments
Explore related questions
See similar questions with these tags.