Reuse/Release Equivalence , Common Closure and Common Reuse Principles applied to the real world example.

Photo by Angeles Pérez on Unsplash

After discussing S.O.L.I.D. principles, it is time to take a look at Software Component Principles. In first set of principles , we talked about principles where we question how to structure software system in more low-level: classes, interfaces, methods. Here we discuss principles in more high-level, where we consider patterns how we build micro services, components, plugins, packages. Component principles have two main directions: Cohesion Principles, Coupling Principles. Today we are going to treat Cohesion Principles and its’ implementation to Spring Boot Application.

In Cohesion…


Essential Design Patterns that are used in JDK

Photo by Alfons Morales on Unsplash

21 famous software design patterns that are summarised and presented by GoF can be found frequently in Java Core Libraries. Depending on situation different patterns are elegant way to implement object oriented programming. Let us have a quick overview to 10 design patterns that are applied in different parts of Java Development Kit.

Creational Design Patterns — this patterns deal with different techniques of object instantiation.

Factory — this design pattern aims to collect instantiation of classes in a single centralised Factory class in order to have a full control over objects. Please see my other article for more information…


Implementation of the Design Patterns in Java and Spring Framework

Photo by Oksana Berko on Unsplash

Template Design Pattern is one of the most used behavioral design patterns. The main idea of this pattern is having an abstract class with final method which is template method and bunch of different sub-steps that are abstract and so free to be implemented. Basically, in this pattern the functionality of a template method can be modified by differently implemented abstract methods. For a better understanding let us take a glance at following cashflow uml diagram.


Implementation of the Design Patterns in Java and Spring Framework

Photo by Steve Johnson on Unsplash

Using proxy behavior is fundamental to information technologies. Appliance of proxies can be for instance found in network connections in form of network proxies. The usage of the Proxy Design Pattern is widespread not only in traditional java based software systems, but also in spring this behavior is one of the basics.

The main idea of the Proxy Design Pattern is delegating one object, which is called proxy in this context, to control the access to another object, which is subject. …


Implementation of the Design Patterns in Java and Spring Framework

Photo by PilMo Kang on Unsplash

Factory Design Pattern is one the most popular Design Patterns and is just like a Singleton Design Pattern (that we discussed in the previous blog), creational Pattern. Factory Design Pattern takes the responsibility of creating different polymorphic objects through a centralized class. Need for such kind of behavior arises as a source code of a particular software system grows by quantity and complexity. As a result, the number of created objects rises and the system structure gets more chaotic.

The traditional way of implementing Factory Design Pattern is to gather the creation of sibling objects in one Factory class and…


Implementation of the Design Patterns in Java and Spring Framework

Photo by Silvio Kundt on Unsplash

One of the most used and simplest design patterns is the Singleton Design Patter. This pattern is part of creational design patterns and deals with special form of object creation. It basically restricts the instantiation of a specific object to more than one. It is especially useful in cases, where there should be single shared instance of an object such as DB connections, logging system or configuration manager, caching manager.

The basic idea is having private constructor and a getter that delivers same instance of an object. In following example we have three kind of Singleton method implementations:

  1. in classical…


Clean Coding in Java with examples

Photo by Philipp Berndt on Unsplash

Clean Code is a key to a better, performant, efficient software system. For almost all software products, except very tiny ones, there will be lots of code and some of them will be indeed bad code. Over time developer teams will change, technologies will change, viewpoints to certain patterns will change and at the end of the day, some code will be bad code. So there is no way to guarantee that source code of a software product will be of only clean code. But there are some golden rules that experienced developer should always have in mind when coding…


DIP: Dependency Inversion Principle

Photo by Tim Mossholder on Unsplash

(skip the first paragraph if you have already read other parts of this blog series)

This article is the last part of the blog series, dedicated to well-known software design principles, that evolved over time and were finally summarised by Robert C. Martin with initials of the corresponding principles. These principles guide us how to build well-designed software systems, giving best practices for arranging classes, functions, building blocks. We will look at each principle in depth and apply it to the Spring Boot Application. The idea is refactoring existing software based on these principles from architectural point of view.

The…


ISP: Interface Segregation Principle

Photo by Agustín Lautaro on Unsplash

(skip the first paragraph if you have already read other parts of this blog series)

This article is the fourth part of the blog series, dedicated to well-known software design principles, that evolved over time and were finally summarised by Robert C. Martin with initials of the corresponding principles. These principles guide us how to build well-designed software systems, giving best practices for arranging classes, functions, building blocks. We will look at each principle in depth and apply it to the Spring Boot Application. The idea is refactoring existing software based on these principles from architectural point of view.

The…


LSP: Liskov Substitution Principle

Photo by Sam Moqadam on Unsplash

(skip the first paragraph if you have already read other parts of this blog series)

This article is the third part of the blog series, dedicated to well-known software design principles, that evolved over time and were finally summarised by Robert C. Martin with initials of the corresponding principles. These principles guide us how to build well-designed software systems, giving best practices for arranging classes, functions, building blocks. We will look at each principle in depth and apply it to the Spring Boot Application. The idea is refactoring existing software based on these principles from architectural point of view.

The…

Ali Zeynalli

Senior Software Engineer with focus on Software Architecture, Software Design.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store