C# · CodeProject · Dotnet

Structural Design Pattern (Part 7) – Final

Dear Reader,

This post wont be longer 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 learn so far in this series blog posts. It’s important to note that, not only learning a pattern is important or a big deal it’s also important to know when to choose what. Its like saying, a good warrior also knows to choose the best weapon in required scenarios. He for sure wont use wrong weapons or use the same everywhere.

When to choose What:

Adapter Pattern:

  • There is an existing component or module which can not be changed but its interface is incompatible with the others.
  • So only one component varies but other remains 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 has same constant interface designed earlier.

Facade Pattern:

  • When you want to define new interface for a group of objects with out adding new functionality.
  • When you want to represent 1 object for a group of objects to simplify communication.

Well dear friend, i hope you have understood the Structural patterns as i did couple of months back. If these long posts helps you in undestanding better, then i am glad and my hard work payed off 🙂

Thanks for reading.

P.S: Please leave your valuable comments for my learning.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s