This post won't be long like the previous one in this series. Also, this would be the last one under this series.
I am writing this post just to summarize what we learned so far in this series of blog posts. It’s important to note that, not only is learning a pattern important or a big deal, it’s also important to know when to choose what. It is like saying, a good warrior also knows to choose the best weapon for every scenario. He for sure won't use the wrong weapon or use the same one everywhere.
When to Choose What
- There is an existing component or module which cannot be changed but its interface is incompatible with others.
- So only one component varies but others remain nearly constants or unchanged.
- When you want to enhance the responsibilities of an object.
- When extension for an object via sub-classing is complex/tedious or even costly.
- Applied if all the classes or components are designed.
- When implementation of components on both sides vary independently but have the same constant interface designed earlier.
- When you want to define a new interface for a group of objects without adding new functionality.
- When you want to represent an object for a group of objects to simplify communication.
Well, I hope you have understood the structural patterns as I did a couple of months ago. If these long posts have helped you understand them better, then I am glad and my hard work has paid off
Thanks for reading.
P.S.: Please leave your valuable comments for my learning.