Writing SOLID code
In computer programming, SOLID (Single responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion) is a mnemonic acronym introduced by Michael Feathers for the "first five principles" identified by Robert C. Martin in the early 2000s that stands for five basic principles of object-oriented programming and design. The principles when applied together intend to make it more likely that a programmer will create a system that is easy to maintain and extend over time. The principles of SOLID are guidelines that can be applied while working on software to remove code smells by causing the programmer to refactor the software's source code until it is both legible and extensible. It is typically used with test-driven development, and is part of an overall strategy of agile and adaptive programming.
S - SRP - Single Responsibility Principle - A Class should have only a single responsibility.
O - OCP - Open/Close Principle - Entities should be open for extension but closed for modification
L - LSP - Liskov Substitution Principle - objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program
I - ISP - Interface Segregation Principle - many client-specific interfaces are better than one general-purpose interface
D - DIP - Dependency Inversion Principle - one should “Depend upon Abstractions. Do not depend upon concretions.
S - SRP - Single Responsibility Principle - A Class should have only a single responsibility.
O - OCP - Open/Close Principle - Entities should be open for extension but closed for modification
L - LSP - Liskov Substitution Principle - objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program
I - ISP - Interface Segregation Principle - many client-specific interfaces are better than one general-purpose interface
D - DIP - Dependency Inversion Principle - one should “Depend upon Abstractions. Do not depend upon concretions.
Comments
Post a Comment