Author name: Filip Gaik

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 »

Dependency Inversion Principle

Dependency Inversion Principle is fifth and last principle from SOLID acronym. The definition states two things. First: high-level modules should not depend on low-level modules. Both should depend on abstractions (e.g. interfaces). Second: abstractions should not depend on details. Details (concrete implementations) should depend on abstractions. In real-life this principle can be compare to devices

Dependency Inversion Principle Read More »

Open Close Principle

Open Close Principle is second principle from SOLID acronym. Definition: Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification. That means if program needs to be changed it should be done without modification of existing code. When it is needed to change behavior of our program, it should be

Open Close Principle Read More »

Scroll to Top