Design Pattern in Java

Rasika Weragoda
1 min readApr 17, 2020

Before going further first look at why we actually need design patterns. so if we have to solve the problem with a bunch of developers, they actually use their own coding patterns because there is no restriction. But what if we have a common vocabulary set to solve that particular problem. which might have easy to communicate with different developers with that common vocabulary set. That is where the design pattern came in play. Particular design pattern (such as singleton) tell the developer that you need to solve this problem using this particular coding pattern, so every developer can understand what is behind the scene and what is the strategy of it.

Alright then, now you know why we need design patterns. So let’s look at what are the design pattern groups

  1. Creational
  2. Structural
  3. Behavioural

So in this article, I mainly focus on the Creational design pattern group, This design pattern focuses on how objects are created. It is more than about replacing the new keyword when talking about creational design pattern.

So in the creational design pattern group, I cover the gang of four design patterns. Which are

  1. singleton
  2. Builder
  3. prototype
  4. Factory

The next article I will explain about singleton design pattern.

--

--