Design patterns are solutions for most commonly (and frequently) occurred problems while designing a software. None of these patterns force you anything in regard to implementation; they are just guidelines to solve a particular problem – in a particular way – in particular contexts. Code implementation is your responsibility. The design patterns are classified in several categories or patterns, such as Creational Design Patterns, ....

Let us learn some of the design patterns.

 

"The state design pattern allows for full encapsulation of an unlimited number of states on a context for easy maintenance and flexibility."

Builder pattern is an alternative way to construct complex objects and should be used only when the increase of object constructor parameter combination leads to an exponential list of constructors. Instead of using numerous constructors, the builder pattern uses another object, a builder, that receives each initialization parameter step by step and then returns the resulting constructed object at once.

Provide an interface for creating dependent objects without specifying their concrete classes.

It is used in scenarios where application needs to create a number of instances of a class, which has almost same state or differs very little.