An Introduction To

SOLID Principles in 59 Seconds

Introduction

What is SOLID?

SOLID is a set of five object-oriented software design principles. Together, they suggest how to divide responsibilities and manage dependencies so a change in one part of the code is less likely to require changes elsewhere.

The acronym stands for Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion.

The example

Shipping notifications

Suppose an online store emails customers when an order ships. Later, it needs to send the same update through text messages and push notifications, then add scheduling and tracking.

01 / TodayEmail

The company emails customers when an order ships.

02 / NextText messages + push notifications

The company decides to also send customer updates by text message and push notification.

03 / LaterScheduling + tracking

The company wants to send updates at a chosen time and check whether the email, text, or push service accepted each message for sending.