Design patterns

Strategy

Strategy is very flexible behavioral design pattern. An object of a class has got an access to strategy collection, which can be set during the runtime of application. By calling one method the object behavior can be changed depending of which strategy was set. Strategy pattern allows to isolate certain behavior from the class, thanks […]

Strategy Read More »

Factory

Factory is a creational design pattern. It is used to delegate the creation of objects to other classes, so that a developer can create an object by calling a single method. Factory pattern encapsulates the creation of objects, so a developer which is using factory doesn’t know how particular object is created and what values of

Factory Read More »

Builder

Builder is a creational design pattern. Builder is used when we have a lot of fields in our class and we do not want to create a lot of constructors and also we do not want another developer to have an access to setters. There are several types of builder pattern. One of them is

Builder Read More »

Observer

Observer is a behavioral design pattern. In this pattern our object, which is observable, contains a collection of observers and notifies them every time when observed state has changed or observed event has happened. This is a subscription mechanism. Let’s see this pattern in real life example. Let’s assume that we have an object with

Observer Read More »

Scroll to Top