Saturday, February 19, 2011

What is SOLID?

SOLID is a collection of best practices object-oriented design principles. The principles when applied together to make 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, to refactor the software's source code until it is both legible and extensible. It may be used with test-driven development, and is part of an overall strategy of agile and adaptive programming.

SOLID is abbreviated by Single Responsibility, Open Closed, Liskov Substitution, Interface Segregation and Dependency Inversion.

1. Single Responsibility Principle: A class or module should have one, and only one, reason to change.

2. Open Closed Principle: Software Entities (Classes, Modules, Functions, and so on) should be open for extension but closed for modification.

3. Liskov Substitution Principle: Functions that use pointers or references to base classes must be able to use objects of derived classes without knowing it.

4. Interface Segregation Principle: Many client specific interfaces are better than one general purpose interface.

5. Dependency Inversion Principle:

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 upon abstractions.

No comments:

Post a Comment