Category: Software Engineering

December 3, 2022

SOL[I]D – The interface segregation principle

We can use the previous classes design to exemplify The Interface Segregation Principle as well. To demonstrate the importance of this principle, consider the scheme below. In the diagram, we can see 3 classes (Fiat, Chevrolet and Hyundai) that implement the “Car” interface. We can see the correspondent code below: All cars must implement the 3 functions of the interface, these are: accelerate(), brake() and […]

November 30, 2022

SO[L]ID – The Liskov substitution principle

The Liskov substitution principle is one of the most important principles of the SOLID principles because it describes how the object orientation must work. Basically, it says that an object of class B and another one of class C, both inherited from a class A, when instanced within a base class variable and some method is called, both the subclasses method should return/work properly without […]

November 4, 2022

[S]OLID – The single responsibility principle

As the same suggests, The Single Responsibility Principle says to us that one entity should be responsible for just one functionality. Some people take this saying to the letter, but we need some common sense when writing code while thinking about the single responsibility of our classes. In other words, the scope of our classes will depend on our project scope. I’m very acquainted with […]