Click here to Skip to main content
12,952,725 members (45,728 online)
Click here to Skip to main content
Add your own
alternative version

Stats

8.4K views
2 bookmarked
Posted 10 Oct 2011

Structural Design Pattern (Part 7) – Final

, 10 Oct 2011 LGPL3
Rate this:
Please Sign up or sign in to vote.
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)

Share

About the Author

zenwalker1985
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/

You may also be interested in...

Comments and Discussions

 
-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170525.1 | Last Updated 10 Oct 2011
Article Copyright 2011 by zenwalker1985
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid