Monday, 22 October 2012

What is Design Pattern and Types of Design patterns?


Design Patterns are coding level constraints to build an efficent and Proveded soluations for recurring problems while building Software systems/applications using Object Oriented Programming.

Design Patterns independent language soluations.

Design Patterns are ready-made soluations for object oriented programming.

Types of design patterns:

yes, GOF(Gang of Four) Categoriges into 3 types based on their main objective.

1. Creational Patterns(creation of objects):
                                     Creating objects an Efficient way.
 these types of patterns are used to define an efficient way of creating objects[un-unnecessarily using new keyword].
these types of patterns uses base types to create objects. [un-aware of concreate classes to define].

these types patterns uses creation of objects. which provide more generic implementation[by hiding concreate classes throug using Factory interfaces/Factory Classes].

Creational Patterns:

Single Pattern  : creates single instance and shares the same object[single object]to multiple clients.

Factory Method Pattern :create object based on the type of input which[generic implementation] generates their apporiate derived objects.

these uses factory types to create object(single object) which create further derived object of same input type object.
 which generally done through methods like

--cmd.CreateConnection()
--cmd.CreateCommand();
                                          .....ect

Abstract Factory Pattern:  creates collection of objects for the Factory types.this exactly Abstract Factory Pattern--->create objects of Factory Types.

DbProviderFactory:--->which are base types for other factory types
         SqlclientFactory.
        OracleClientFactory,....ect. which creates an apporiate derived types.

Builder Pattern: when we require object construction from its representation. when object construction is complex from it's representation(final output:end result).

commandBuilder,StringBuilder,...ect

Structural Patterns:
                              Abstraction and Implementation and abstraction through their own classes.
advantage : through avoiding copuling( achiving decopuling)

makes object relationships(objects get together) to build large system. without distrub existing implementation.[using addtional interfaces and abstract classes]. these objects from different components.

Interfaces----good  Standarzation of coding.
Classes-------good for providing implementation/avoiding copuling(or)decopuling.

Adapter Pattern : makes implementation is sperateded to their own classes.

SqlDataAdapter, OracleDataAdapter.....ect

Bridge Pattern   : makes implementation in thier own classes/concreate classes and Providing abstraction.

--open() and --close() methods of SqlConnection.
--open(0 and --close() methods of OracleConnection.

Proxy pattern...ect

Behavioural Patterns:

           communication and dispatching of responsibilities  between objects. By doing so, these patterns increase flexibilities in carrying out this communication improves. They shift your focus from flow of control to the way objects are interconnected.
                                   these patterns improve the communication between different objects in a flexibility.

Chain and Responability
Observe pattern
State pattern
Stagery pattern....ect


References:

http://dotnetascent.blogspot.in/search/label/Design%20Patterns, dotnetuncle,..ect

No comments:

Post a Comment