Understanding DesignPatterns in C#
A pattern is a model or design used as a guide in the development of a craft. In a way, software development is also a craft and the usage of design patterns helps us to provide standardized and efficient solutions to software design and programming problems. Design Patterns are evolved from the concepts of object-oriented programming and are used as reusable solutions to the problems that we encounter in day to day programming. They are generally targeted at solving the problems of object generation and integration. The four authors of the book, “Elements of reusable Object-oriented software”, often referred to as “The Gang of Four” were the first to suggest the idea of using design principles in actual production. There are three types of Design Patterns:
- Creational: Creational Design Patterns deal with the object creation and initialization. This concept gives the program more flexibility in deciding which objects need to be created for a given case
E.g.: Singleton, Factory, Abstract Factory etc.
- Structural: Structural Design Patterns deal with class and object composition. This pattern focuses on decoupling interface and implementation of classes and its objects.
E.g.: Adaptor, Bridge etc.
- Behavioral: Behavioral Design Patterns deal with the communication between Classes and Objects.
E.g.: Chain of Responsibility, Command, Interpreter etc.