Learning Design Patterns
Explore creational design patterns and discuss the three most common types.
We'll cover the following
Design patterns is a class that developers take often while on-the-job, mainly as a refresher because it is taught in college. It ensures a common ground of understanding, which is why it is helpful for TPMs to take the class as well if it’s available. Here, we’ll explore two groups of design patterns: creational and structural. There are more, but these are the two that we find the most useful for a TPM to have a good understanding of.
Creational design patterns
Creational design patterns are related to the creation of objects. By creation, we are referring to how to create an instance of an object. We’ll discuss three of the more common creational design patterns.
Builder pattern
The builder pattern separates the construction of an object from the specific composition of that object. As an example, we’ll take the Mercury subsystem, where we might have two different styles of message we can send: rich text and simple text. A builder will allow us to specify a generic set of building methods that each object type will then provide its specific implementations of. The rich text builder would include additional steps in the method to handle rich text data such as text formatting, whereas the simple text builder would just need to deal with the text itself. In this way, the application can deal with a single builder object, and depending on which type is instantiated, the output can be specific to the needs of the object.
The figure below represents a simple builder pattern that is present in most OOP languages today:
Get hands-on with 1400+ tech skills courses.