Click here to Skip to main content
15,886,864 members
Articles / All Topics

Structural Design Pattern (Part 7) – Final

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
10 Oct 2011LGPL31 min read 9.6K   2  
Not only is learning a pattern important or a big deal, it’s also important to know when to choose what.

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

Adapter Pattern

  • 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.

Decorator Pattern

  • When you want to enhance the responsibilities of an object.
  • When extension for an object via sub-classing is complex/tedious or even costly.

Decorator Pattern

  • 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.

Facade Pattern

  • 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.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
Software Developer (Senior) Siemens
India India
A .net developer since 4+ years, wild, curious and adventurous nerd.

Loves Trekking/Hiking, animals and nature.

A FOSS/Linux maniac by default Wink | ;)

An MVP aspirant and loves blogging -> https://adventurouszen.wordpress.com/

Comments and Discussions

 
-- There are no messages in this forum --