Creational design pattern deals with object creation mechanisms, trying to create objects in a manner suitable to the situation. The basic form of object creation could result in design problems or added complexity to the design. Creational design patterns solve this problem by somehow controlling this object creation.
Abstract Factory :- When we want to create object using super class and want to hide subclass than we use Abstract method. In this pattern we use a method to create the object. Ex, XmlReader and XmlTextReader are the best example where we use XmlReader.Create(..) method to create the object of XmlTextReader,ASP .Net use AbstractFactory pattern in Handler implementation through IHTTPHandlerFactory interface.
Builder Patter :- Separate the construction of a complex object from its representation so that the same construction process can create different representations.In this pattern we create the object step by step. Example StringBuilde
Factory Pattern :- A Factory Pattern is one that returns an instance of class depending on parameter passed. Means which class object should be created it decide on run time.
Prototype Pattern :- When creating an object is very time consuming or complex in some way than we can just make the clone of existing object. This is called Prototype pattern.
Example : When we create shallow and deep it is an example of Prototype.
Singleton Pattern :- Singleton pattern ensure that a class should have only one instance and provide a global access to that instance.
Abstract Factory :- When we want to create object using super class and want to hide subclass than we use Abstract method. In this pattern we use a method to create the object. Ex, XmlReader and XmlTextReader are the best example where we use XmlReader.Create(..) method to create the object of XmlTextReader,ASP .Net use AbstractFactory pattern in Handler implementation through IHTTPHandlerFactory interface.
Builder Patter :- Separate the construction of a complex object from its representation so that the same construction process can create different representations.In this pattern we create the object step by step. Example StringBuilde
Factory Pattern :- A Factory Pattern is one that returns an instance of class depending on parameter passed. Means which class object should be created it decide on run time.
Prototype Pattern :- When creating an object is very time consuming or complex in some way than we can just make the clone of existing object. This is called Prototype pattern.
Example : When we create shallow and deep it is an example of Prototype.
Singleton Pattern :- Singleton pattern ensure that a class should have only one instance and provide a global access to that instance.
No comments:
Post a Comment