SOLID Principles: Summary

An extrmely simple summary of the SOLID Principles:


As systems scale, the SOLID Principles become more important.

The Single Responsibility Principle

This is to do with the design of individual models. It says that a modules (classes) should have one and only one role to play (ie. it should have only one reason to change).

The Open-Closed Principle

You should be able to extend a module, but changes to a module shouldn’t effect existing clients.

The Liskov Substitution Principle

Best explained by example:

If, in our program, we define a lion as a kind of cat, then everything that could reasonably be said about a cat can also be said about a lion. In other words, we can treat a lion as if it was a cat… because it is one.

This is rarely violated in in code that I have seen, but has been the source of subtle and unpleasant issues when it has.

The Interface Segragation Principle

This principle is about the way that modules interact with other modules. It says that a module shouldn’t tell everyone everything about itself, but only the things that they need to know.

The Dependency Inversion Principle

Leave a Reply

Your email address will not be published. Required fields are marked *