SOLID – The Dependency-Inversion Principle

We have now reached the grande finale of the blog series on SOLID, the big D, The Dependency-Inversion Principle. Let’s jump right into it. Definition The Dependency Inversion Principle (DIP) states: A: High-level modules should not depend on low-level modules. Both should depend on abstractions. B: Abstractions should not depend upon details. Details should depend […]

SOLID – The Interface Segregation Principle

We are closing in on the final principle of SOLID. In the last post I wrote about the Liskov Substitution Principle, and now it is time to take a look at The Interface Segregation Principle (ISP). Definition The Interface Segregation Principle was coined by Robert C. Martin. It is explained in his book ”Agile Software […]

SOLID – The Liskov Substitution Principle

In the previous post I wrote about the O in SOLID, The Open/Closed Principle. Now it is time for the L, The Liskov Substitution Principle (LSP). Definition In the year 1988, the American Computer Scientist Barbara Liskov, wrote What is wanted here is something like the following substitution property: If for each object o1 of […]

SOLID – The Open/Closed Principle

In this third post on the SOLID principles we will look at the Open/Closed Principle (OCP). Definition Bertrand Mayer coined the Open/Closed Principle in 1988, and it states that ”A software entity (class, module, function) should be open for extension but closed for modification”. A software entity complies to OCP if its behavior can be […]

SOLID – The Single-Responsibility Principle

You are now reading the second part of my blog series on the SOLID principles. In the first post I introduced the concept and gave some reasons to why you should learn about SOLID. In this part I will write about the first of the five SOLID principles, the Single-Responsibility Principle (SRP). Definition The Single-Responsibility […]

Cleaner Code with Command Query Separation

What is Command Query Separation? The Command Query Separation (CQS) concept is a way to structure your code and methods. The idea is that a method may either be a Command or a Query but not both. It was coined by Bertram Meyer in his book ”Object Oriented Software Construction” from 1994. What identifies a […]