Wednesday, 20 November 2013

Design Patterns

A design pattern is a reusable solution that can be implemented on software problems that commonly occur in development. There are very many design patterns that are employed in software design and they are classified according using concepts such as delegation(representation), aggregation(constituent components), consultation(reference) which are into groups, creational patterns, behavioral patterns, structural patterns and concurrency patterns. There is another architectural design pattern that is also becoming very common Model-View-Controller pattern. Object-oriented design patterns typically show relationships and interactions between classes or objects.

Creation Design Patterns
Based on object creations although could result in design problems or added complexity to the design. The approach is to solve this problem is control of object creation. They are grouped further into Class creational and Object creational patterns. Well-known design patterns;-

  • Abstract Factory pattern
  • Builder pattern
  • Factory method pattern
  • Prototype pattern
  • Singleton pattern

Behavioral Patterns
In software engineering, behavioral design patterns are design patterns that identify common communication patterns between objects and realize these patterns. By doing so, these patterns increase flexibility in carrying out this communication.

  • Observer pattern also known as Publisher/Subscriber pattern;-
Objects register to observe an event that may be raised by another object.The observable object holds reference to many observer objects that are registered(subscribed) to it and can be removed(unsubscribed). The observable gives information(publishes) to the observers(subscribers) that are registered(subscribed) and also updates the observers too.
  • Iterator pattern
  • Chain of responsibility pattern
  • Command pattern
  • State pattern
  • Strategy pattern
  • Template method pattern
  • Visitor pattern
  • Null object pattern

Structural Patterns

Design patterns that ease the design by identifying a simple way to realize relationships between entities(aggregation).
  • Facade pattern -  create a simplified interface of an existing interface to ease usage for common tasks.
  •  Adapter pattern
  • Aggregate pattern
  • Decorator pattern
  • Composite pattern
  • Proxy pattern
  • Pipes and Filters pattern

Concurrency Pattern
Concurrency design patterns are those types of patterns that deal with the multi-threaded programming paradigm. Examples:
  • Thread pool pattern - acts in a round-robin fashion.
  •  Monitor Object pattern
  • Balking pattern
  • Double-checking locking pattern
  • Guarded suspension pattern
  •  Reactor pattern
  • Read-write lock pattern
  • Scheduler pattern
  • Thread-specific pattern

MVC(Model-View-Controller) pattern
In Software Architecture, it is a design pattern that involves de-coupling of business rules, data, functions, logic from user's interaction with it. The Model consists of business rules, data, logic, functions and View consists of representation of data, such as a diagram. Controller is the mediator of communication between the two, Model and View.

No comments:

Post a Comment