The observer pattern provides one object with a common and loosely couple method of informing multiple different objects about changes in its properties.
Use the observer pattern when one objects state affects multiple other objects.
The strategy pattern provides objects with the ability to change their behavior (aka. strategy).
Use the strategy pattern when objects can be associated with one instance of multiple varying objects with a common
The visitor design pattern allows you to add new methods to other classes without creating major changes.
Use the visitor pattern when you have multiple objects, which you want to add variations of the same algorithm to.
The command design pattern uses an object to represent a method
Use the command pattern when you have a method in one part of your system, which you want to invoke from another part, without also having to pass all necessary arguement.
The builder design pattern helps separating the construction of complex objects from the context where they are needed.
Use the builder pattern when you have several variations of the same object, which needs to be created repeatedly.
The factory pattern provides guidelines for how to flexibly and conveniently create different objects with the same method, by only changing the argument of the method.
Use the factory pattern whenever you want one method to return multiple possible classes which have a common super class.
The singleton design pattern intends to creates a class which only exists in a single instance. This allows for consistent and convenient retrieval of data.
Use the singleton design pattern whenever you have an object which needs to be present multiple places in the project, but only logically should exist as a single instance.
The composite design pattern is intended for structuring data classes with a relationship to each other.
Use the composite pattern whenever you encounter a data structure which requires a parent-child-relationship, but also enables parent-parent-references.
The adapter design pattern allows the behavior of the object to be converted into a desired form.
Use the adapter pattern whenever you want to align the functionality of multiple different variations of the same type of object.
The facade pattern is based on the concept of simplifying activities. It allows us to wrap complex procedures in a facade class and afterwards utilize these procedures by one simple method call.
Use the facade pattern whenever you have a complex procedure which you need to repeat multiple times.
The decorator pattern exploits composition of classes instead of inheritance to gain flexibility at runtime and avoid class explosions.
Use the decorator pattern whenever you need an obejct structure based on core one or more core elements and optinal additional elements. For example: A pizza (core) with toppings (additional).
My name is Daniel H. Jacobsen and I’m a dedicated and highly motivated software developer with a masters engineering degree within the field of ICT.
I have through many years of constantly learning and adapting to new challenges, gained a well-rounded understanding of what it takes to stay up to date with new technologies, tools and utilities.
The purpose of this blog is to share both my learnings and knowledge with other likeminded developers as well as illustrating how these topics can be taught in a different and alternative manner.
If you like the idea of that, I would encourage you to sign up for the newsletter.