Liskov Substitution Principle

Liskov Substitution Principle

The Liskov Substitution Principle (LSP) states that subtypes must be substitutable for their base types. When this principle is violated, it tends to result in a lot of extra conditional logic scattered throughout the application, checking to see the specific type … Continued
Open-Closed Principle

Open-Closed Principle

The Open-Closed Principle (OCP) states that software entities (classes, modules, methods, etc.) should be open for extension, but closed for modification. In practice, this means creating software entities whose behavior can be changed without the need to edit and recompile … Continued
Single Responsibility Principle

Single Responsibility Principle

The Single Responsibility Principle (SRP) states that a class should have only one reason to change.  It was first cited in this form by Robert C. Martin in an article that later formed a chapter in his Principles, Patterns, and … Continued
Persistence Ignorance

Persistence Ignorance

The principle of Persistence Ignorance (PI) holds that classes modeling the business domain in a software application should not be impacted by how they might be persisted. Thus, their design should reflect as closely as possible the ideal design needed … Continued
Stable Dependencies

Stable Dependencies

The Stable Dependencies Principle states that “The dependencies between software packages should be in the direction of the stability of the packages. That is, a given package should depend only on more stable packages.” Whenever a package changes, all packages … Continued
Tell Don’t Ask

Tell Don’t Ask

The Tell, Don’t Ask (TDA) principle suggests that it is better to issue an object a command do perform some operation or logic, rather than to query its state and then take some action as a result. It is related … Continued
YAGNI

YAGNI

YAGNI, or “You Ain’t Gonna Need It” (or “You Aren’t Gonna Need It”), emerged as one of the key principles of Extreme Programming.  Put another way, the principle states: “Always implement things when you actually need them, never when you just … Continued
Inversion of Control

Inversion of Control

Inversion of Control (IoC or IOC) describes a system that follows the Hollywood Principle. That is, flow of control within the application is not controlled by the application itself, but rather by the underlying framework. Typically in such an architecture, … Continued
Keep It Simple

Keep It Simple

The KISS principle, or Keep It Simple, Stupid, spans many trades, industries, and professions.  The more complex something is, the more ways there are for it to fail, and the more difficult it is to explain to someone else who … Continued
Hollywood Principle

Hollywood Principle

The Hollywood Principle states, “Don’t Call Us, We’ll Call You.” It’s closely related to the Dependency Inversion Principle, and illustrates a different way of writing software from the more traditional form of programming in which one’s own code dictates the flow … Continued