Skip to main content

Posts

Showing posts with the label solid principal

Abstract Factory design pattern analysis

What is the Abstract Factory design pattern?   The intent or definition of Abstract Factory is “ Provide an interface for creating families of related or dependent objects without specifying their concrete classes ” It's a bit of a complicated definition, so we'll need to break it down into meaningful chunks to understand it. 1.  " Provide an interface "  When we discuss the Abstract Factory, we are referring to interfaces rather than abstract classes. Essentially, this design pattern provides us with an interface, similar to those found in Java, C#, or Typescript (abstract class).   Why interface?  Whenever we talk about any design pattern, we focus on how we will use it rather than how we will implement it. Because a concrete class creates tight coupling, whereas an interface isolates it from the rest of the system, an interface is always the better choice. We can get different solutions at runtime without having to update our code.

Subscribe for latest tutorial updates

* indicates required