If you have read any of my work, you will know that I am a huge fan of Robert C. Martin's SOLID principles and DRY (don't repeat yourself) by Andy Hunt and Dave Thomas (Martin, Thomas). Every pattern that the Gang of Four identified is a manifestation of these six principles. In fact, almost 70% use abstractions in the same was a the fundamental principle, only the intention of the pattern is different.
Sometimes working backwards from the patterns can lead to traps. We have favorite patterns, we start looking for problems we can solve with them, and we may miss using the patterns that the design really needs. It is crucial to understand the principles and how to design using them. That will naturally lead to almost all of the patterns, and help us recognize when we may be applying the wrong pattern.
My posts attack this from both directions. Sometimes I explore problems and how we can use the principles to lead to patterns that solve them. Other times I look at the patterns from the outside in. I do what the book does not do: take the problem they are solving, identify why one or more principles need to be used, and how that builds the appropriate design pattern. These articles are the solutions that I have posted so far. I put them in alphabetical order, but if you are starting out with design patterns the best place to start is with the adapter pattern:
- Adapter: Plug and Play, also see the blog post: Static is Evil
- Decorator
- Singleton: There can be only one!
No comments:
Post a Comment