Objects in a program should be replaceable with instances of their sub-types without altering the correctness of that program Robert C. Martin “At the beginning, keep things simple and concrete – stick to that as long as possible/necessary.” “Correct abstractions usually come after careful thinking and initial minimal, concrete implementation” “Incorrect abstractions usually come from […]
Best Practices
SOLID – Open/Closed
Def. Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification Robert C. Martin In object-oriented programming, the open/closed principle states that “software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification” Usually, the first impression that comes out about this principle is confusion: it […]
SOLID Principles
SOLID is an acronym formed from the most basic, yet very important principles in OOP, defined by Robert C. Martin, back in 2000: 1. Single Responsibility 2. Open/Closed 3. Liskov Substitution 4. Interface Segregation 5. Dependency Inversion What I love about these principles are 2 things: Simple to understand and remember. They are compact, very concrete, with smallest […]
SOLID – Single Responsibility
Def. A class should have only a single responsibility (Robert C. Martin) “S” in SOLID acronym stands for Single Responsibility Principle.The definition seems quite obvious, intuitive and simple. But it’s not.Let’s clarify it. In order to proceed, I will introduce 2 new terms: Business Responsibility is business requirement, functionality that describe public class’ interface. It usually comes from […]