Creational Patterns – A short word about it

Creational Patterns – A short word about it

Reading Time: ~ 2 minutes

As mentioned in this previous post it is important that developers have an understanding of some patterns that are common in our profession. The Creational Patterns are a grouping of some of these patterns.

A short word on Patterns grouping

A “basket” of patterns, such as the Creational one, is used to put similar patterns together. This is just a way of organizing our thoughts and making it easier to recall the usage that we have for each pattern. We have three main groups: Creational, Structural and Behavioural. All of which we will talk about.

Creational Patterns

The patterns which are gathered together under the Creational Pattern umbrella are patterns that take care of instantiation of objects. These instantiations can be of mostly two kinds:

  • Class – here we use inheritance to create different kind of classes.
  • Object – delegates the instantiation process to another object.

The Creational Patterns are useful when the system grows and we start having too many dependencies. Thus by making use of these, we cut these dependencies by letting only one object take care of it and the others dealing with an Interface only (program to interfaces, not implementations). We also have the added benefit of hiding how objects are created, and so we take the responsibility of the callee class of knowing this.

Competition and Cooperation among Patterns

There are times where you can use more than one pattern. In this case, you should weight the pros and cons of each or simply go with the one your team is most comfortable with. Other times two Creational Patterns can cooperate and complement each other. Either way, you should know how these patterns work in order to take full advantage of them.

 

List of Creational Patterns

  • Abstract Factory
  • Factory Method
  • Builder
  • Prototype
  • Singleton

Leave your opinion, start a discussion, share an experience or just a compliment...

%d bloggers like this: