Introduction We will split our discussion into three sections - where to use this design pattern, how to use this design pattern and what is this design pattern. I will discuss what is builder design pattern at the end because the definition of any design pattern will not make sense until you know how and where to use it. In order to discuss where to use builder design pattern, we need to start with the problem statement. Problem Statement (Where to use builder design pattern): Create a class to store the following details of a customer in the database: private String firstName; //required private String lastName; //required private String phone; //optional private String shippingAddress; //optional private String billingAddress; //optional public class User { private String firstName ; //required private String lastName ; //required private String phone ; //optional private String shippingAddress ; //optional
Types of Design Patterns Creational Pattern: This design pattern covers the different ways to create an object. We will discuss all of them in the later posts of this blog: Builder Abstract Factory Factory Method Object Pool Prototype Singleton Structural Pattern: Once an object is created, the next job is to create a relationship between the different objects and it can be done using a structural design pattern. The different types of structural design patterns that we will discuss in the future posts are: Adapter Aggregate Bridge Composite Decorator Extensibility Facade FlyWeight Marker Pipes and Filter Opaque Pointer Proxy Behavioral Pattern: In the last two patterns, we have created an object and established a relationship between different objects. Now, we need to figure out ways to communicate with the different objects. Behavioral design pattern helps us in channelizing the communication between the newly created objects. The different type