Skip to main content

Posts

Showing posts from September 29, 2019

Builder Design Pattern In Java

Greetings! Builder design pattern is a creational design pattern which helps us creating objects. According to GoF, Builder design pattern; "Separate the construction of a complex object from its representation so that the same construction processes can create different representations." Eventhough the original pattern description talked about complex object creation, most used scenario is to help constructing objects fluently. Builder design pattern helps us to assemble objects part by parts hiding inner states. In this post i'm going to talk only about normal object creation using this pattern. As I said earlier, this is a convienient way to construct objects with many parameters. Let's say you have a class which needs 10 parameters. Are you going to create a constructor with 10 arguments? Which is very difficult to maintain and use. This is where i'm giong to use Builder design pattern. Help to create objects with multiple parametes in simple