Software Development Principles

The SOLID Principles:

➤ The Single Responsibility Principle

Stated in its most extreme form, the Single Responsibility Principle is that a class should have only one reason to change.

➤ The Open/Closed Principle

This principle states that “Software entities should be open for extension, but closed for modification”.  In other words, you should never change working code. Instead, reuse it somehow (for example, by inheritance) and extend it.

➤ The Liskov Substitution Principle

Code written to use an object of a certain type should not have to change if provided with an object of a derived type.  If you find yourself writing branching logic so that your function does one thing if provided with a base class, but something else for a derived class, you have violated this principle.

➤ The Interface Segregation Principle

an interface with many functions should be broken up into smaller, cohesive parts. Consumers should rely on only one of the mini-interfaces, not on the “fat” whole.

➤ The Dependency Inversion Principle

In an interface-based language, this principle usually finds its expression in the related idea of dependency injection. If class A needs the services of B, it does not construct B. Instead, one parameter to A’s constructor is an interface that describes B. A no longer depends on B, but on its interface. When A is constructed, a concrete B is passed in. B, too, depends on its interface.


The DRY Principle

Don’t Repeat Yourself,  every piece of knowledge must appear only once

Responses are currently closed, but you can trackback from your own site.

Comments are closed.