Category: SOLID
-
Dependency Inversion Principle
Quoting Uncle Bob – “DIP- The Dependency Inversion Principle (DIP) tells us that the most flexible systems are those in which source code dependencies refer only to abstractions, not to concretions.” I’ll try to break this down: In Java, abstractions translate to interfaces or abstract classes where as concretions are implementations of these interfaces or […]
-
Interface Segregation Principle
The Interface Segregation Principle is a guideline for designing interfaces (like classes or methods) in a way that makes them more specialized and easier to use. It says that instead of having one big interface with lots of different methods, it’s better to break it up into smaller interfaces, each with a specific set of […]
-
Liskov Substitution Principle
The Liskov Substitution Principle (LSP) is a principle in object-oriented programming that states that objects of a superclass should be able to be replaced with objects of a subclass without affecting the correctness of the program. In other words, if a class B is a subclass of class A, then an object of class A […]
-
Open-Closed Principle(OCP)
Definition: The Open-Closed Principle (OCP) is a software design principle that states that software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification. This definition gave me jitters when I first heard it. Let’s pause for a bit, take a deep breath, try to process it slowly and possibly try […]
-
Single Responsibility Principle
The Single Responsibility Principle (SRP), a guideline for software development, states that every class, function or module should have a single purpose and should only carry out tasks required to achieve that objective. This means that each class should be focused on simply carrying out the tasks required to fulfil its single, clearly defined responsibility. […]