Design Patterns

Posted by: admin
Category: C#

Design PatternsPreface

It seems around two months ago, I have been asked about the some questions about Design Patterns by one of my peer which encouraged me to write a series of blog here about the “Design Patterns”. Since I am coming from .Net background, I will try to provide an examples with c# throughout this series of patterns introduction.

What is Design Patterns?

First word comes to our mind when someone asks about “What is Design Patterns?” is, designing something with defined way or technique. Yes, you might have seen that someone else’ code might be cleaner than you or it might works better than yours and you may wonder that how simply that developer has done. Here, design patterns comes into picture and which makes you achieve the goal with the help of using classes.

You might have heard about GOF (Gangs of Four). No? Let me tell you that there are at least 100 patterns available but from that 23 patterns got an identity in the book “Design Patterns: Elements of Reusable Object Oriented Software” written by Gamma, Helm, Johnson and Vlissides. These four authors are popular as Gangs of Four due to the patterns described in their book. These patterns are definitely worth learning and helpful in programming with object-oriented programming.

Is this for me or Why do I need it?

Design Patterns are useful as a solution for common programming problems. But to understand these patterns throughout this series, you might need:

  • Understanding of C#
  • Core concepts of Object Oriented Programming

Along with solving a problem it also allows developers to implement them in any type of applications or in any object oriented languages. This patterns also provides scenario based solutions to developers.

Design Pattern Categories

There are number of categories available along with different patterns associated with it. As I have aforementioned, I will try to follow GOF patterns throughout the series. According to GOF, all those 23 patterns are divided into mainly 3 categories. Categories containing the list of patterns are listed below.

Creational Patterns

  • Abstract Factory
  • Factory Method
  • Builder
  • Prototype
  • Singleton

Structural Patterns

  • Adapter
  • Bridge
  • Composite
  • Decorator
  • Façade
  • Flyweight
  • Proxy

Behavioural Patterns

  • Chain of Responsibility
  • Command
  • Interpreter
  • Iterator
  • Mediator
  • Memento
  • Observer
  • State
  • Strategy
  • Template Method

As of now I have just listed the list of patterns for categories but I am going to explain each of these methods along with example throughout this series along with the scenarios which method has to implement and when to implement.

There are lots of other methods available as I foresaid that all have their own benefits and cases available to implement. You can also use whenever you need it.

As of now, I am putting down my pen for this first blog of the series but you can share your feedback or any questions you have in your mind about this blog or related any design patterns to me on following contact details.

Few Quick References:

Author: Naishadh Patel

Let’s build your dream together.