AspBucket offers ASP.NET, C#, VB, Jquery, CSS, Ajax, SQL tutorials. It is the best place for programmers to learn

Friday 6 October 2017

Introduction to design patterns

This article gives you an introduction of design pattern. Design patterns help to solve the issue related to software development problems. The solution will be minimal coupling between modules.
Design pattern are categorize in three parts
  1. Creational Patterns
  2. Structural Patterns
  3. Behavioral Patterns

1- Creational Patterns

The Creational design pattern is used to deal with the creation of objects. It is used, how the object is created and utilize in the application. It may be the simple object creation may increase the complexity that can be solved by creational design pattern. Creational design patterns are categories in five types.
  1. Abstract Factory  A single Factory class that returns the different sub-classes based on the input provided and factory class uses if-else or switch statement to achieve this.
  2. Builder It providing a way to build the object step-by-step and provide a method that will actually return the final Object.
  3. Factory Method Creates an instance of several derived classes
  4. Prototype This pattern uses cloning to copy the object.
  5. Singleton It maintains the single instance of class

2- Structural Patterns

Structural design patterns are used to design the relationship between entities. It helps to structure our objects, the relationships and inheritance between classes & add additional functionality to an object at run time.

  1. Adapter  The object that joins these unrelated interface is called an Adapter
  2. Bridge Separates an object’s interface from its implementation
  3. Composite When we need to create a structure in a way that the objects in the structure has to be treated the same way, we can apply composite design pattern.
  4. Decorator Add responsibilities to objects dynamically
  5. Facade A single class that represents an entire subsystem
  6. Flyweight A fine-grained instance used for efficient sharing
  7. Proxy An object representing another object

3- Behavioral Patterns

Behavioral design patterns are design patterns that identify common communication patterns between objects and realize these patterns.

  1. Chain of Responsibility Multiple objects can handle a request and the handler doesn't have to be a specific object. A set of objects should be able to handle a request with the handler determined at run-time.
  2. Command Command pattern forwards the request to a specific module
  3. Interpreter A way to include language elements in a program
  4. Iterator Sequentially access the elements of a collection
  5. Mediator Defines simplified communication between classes
  6. Memento Capture and restore an object's internal state
  7. Observer A way of notifying change to a number of classes
  8. State Alter an object's behavior when its state changes
  9. Strategy Encapsulates an algorithm inside a class
  10. Template Method Defer the exact steps of an algorithm to a subclass
  11. Visitor Visitor lets you define a new operation without changing the classes of the elements on which it operates. 

   1 comment :

  1. This comment has been removed by a blog administrator.


  • Popular Posts
  • Comments