Design patterns are broadly categorized into following:
Creational design patterns are used for creating objects. In this blog we will be covering the mostly used creational design patterns. We will be covering structural and behavioral design patterns in upcoming blogs.
1. Constructor Design Pattern
- This is the simplest creational design pattern.
- Whenever we use
newkeyword, we will be using this design pattern.
- This design pattern is used to create new objects using
2. Prototype Design Pattern
- This is a design pattern using which properties and methods are added/updated in prototype of objects.
3. Module Design Pattern
- This design pattern provides encapsulation.
- It was developed in 2003.
4. Enhanced Module Design Pattern
- It is an enhanced version of Module Pattern.
- It provides all features of module pattern but with cleaner coding style.
- It is highly used in third party libraries.
5. Singleton Design Pattern
- This design pattern makes sure that only one Instance is created throughout the application
- Example: Task Manager of Windows
- This design pattern simplifies object creation.
- It creates different types of objects based on requirement.
Design patterns are very useful for creating efficient applications. Each design pattern has some unique feature which helps us to write better and organized code.