Software Design Patterns

Software design patterns are reusable solutions to commonly occurring problems within given contexts in software design, and represent the best practices used by experienced developers. Design patterns can speed up the development process by providing tested, proven development paradigms.

Creational Patterns (GOF)
The design patterns provide a way to create objects while hiding the creation logic without using new operator.

Singleton Define a class which has only single instance
Factory Define an interface for creating a single object, but let several derived classes decide which class to instantiate
Abstract Factory Provide an interface for creating a factory of related objects without explicitly specifying their classes. It is also called factory of factories.
Builder Using simple objects and using a step by step approach to builds a complex object
Prototype Implement a prototype interface which tells to create a clone of the current object. This pattern is used when creation of object directly is costly
Object Pool Avoid expensive acquisition and release of resources by recycling objects that are no longer in use

Structural Patterns (GOF)
The design patterns focus on class and object composition. Class creation patterns use inheritance to compose interfaces, and object patterns define ways to compose objects to obtain new functionality.

Adapter (translator) Convert the interface of a class into another interface, and work as a bridge between two incompatible interfaces
Bridge  Separates an object’s interface from its implementation so that the two can vary independently
Composite Composes objects in term of a tree structure to represent part as well as whole hierarchy
Decorator Wraps the original class and add additional functionality without altering its structure (class methods signature)
Façade Provide a unified interface to a set of interfaces in a subsystem
Flyweight Reduce object count, and provide a fine-grained instance used for efficient sharing
Proxy A class represents functionality of another class

Behavioral Patterns (GOF)
The design patterns are all about communication between Class objects.

Chain of Responsibility Provide a way of passing a request between a chain of objects (receivers)
Command Encapsulate a request as an object (command), thereby letting you parameterize clients with different requests, queue or log requests, and support undoable operations.
Interpreter A way to include language elements in a program
Iterator Access the elements of a collection object in sequential manner without any need to know its underlying representation
Mediator Define a class object that encapsulates how a set of classes communicate. Mediator promotes loose coupling by keeping objects from referring to each other explicitly, and it lets you vary their interaction independently.
Memento Capture and restore an object’s internal state
Observer Define a one-to-many dependency between objects where a state change in one object results in all its dependents being notified and updated automatically.
Strategy Define a family of algorithms, encapsulate each one. A class behavior or its algorithm can be changed at run time.
Template Method (Template) Defer the exact steps of an algorithm to a subclass
Visitor Represent an operation to be performed on the elements of an object structure. Visitor lets you define a new operation without changing the classes of the elements on which it operates.[wiki]
Null Object Replaces check of NULL object instance

Architectural patterns

Model View Controller Divides a software application into three interconnected components: model, view and controller
Service locator Encapsulate the processes involved in obtaining a service with a strong abstraction (such as JNDI lookup).
Data Access Object (DAO) Provides an abstract interface to some type of database or other persistence mechanism without exposing details of the database etc.
Data Transfer Object (DTO) An object that carries data between processes
Publish Subscribe a messaging pattern
Identity map Providing a context-specific, in-memory cache to prevent duplicate retrieval of the same object data from the database

Concurrency patterns
Active object
Balking
Double-checked locking
Event-based asynchronous
Guarded suspension
Join
Lock
Monitor
Proactor
Reactor
Read write lock
Scheduler
Thread pool
Thread-local storage

Others
Dependency injection
Lazy loading
Mock object

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on RedditShare on StumbleUponEmail this to someoneShare on TumblrDigg this

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">