Easy real-life examples to explain SOLID principles

Oliver Bisseker
Jun 10, 2019 · 3 min read

Most, if not all of you, are aware of the SOLID principles. How many of you apply them day to day?

To help you understand how you can implement SOLID principles, I’m not going to recount the same descriptive lines you’ll find on every other SOLID blog post. Instead, I’m going to give you examples. To understand SOLID principles, I suggest reading these articles:

Single responsibility

All methods on an object should directly contribute to the primary outcome of the object, of which there should be exactly one.

Open (to extension), Closed (to modification)

If you have a “SaveCustomer” method, you shouldn’t stop it from saving a customer (closed to modification). You could add another step to send a welcome email (open to extension). Open closed applies at all levels, e.g. Don’t modify an interface or class by removing methods or changing method signatures, instead add new methods or overloads of existing methods.

Liskov Substitution

A particular taxi app offers these options: standard (base type), large (fit’s larger groups) (descendant), and executive (descendant), etc. The company must send a car that fit’s larger groups if you choose the large option. The only requirement of the standard option is for a car that can get you from A to B. Any car, whether from the standard, large or executive options fulfills that requirement as the other options inherit and extend from the standard option.

Interface segregation

You shouldn’t offer interfaces that are a “pack” of options. You should have each option in its own interface so that people inheriting from them later down the line can choose the options they require. This means you are not implementing functionality you don’t need or paying for options you are not interested in.

Dependency Inversion

When you book a hotel room (an object you rely on), you’re relying on the hotel (an outside source) providing you with a room on your arrival.


The most effective method to keep code quality high is by creating well designed code because you don’t always have time to refactor the code later.

Join the Capgemini Microsoft team, open roles here.

Capgemini Microsoft Team

A place for the Capgemini Microsoft Team to share their…

Oliver Bisseker

Written by

Capgemini Microsoft Team

A place for the Capgemini Microsoft Team to share their experiences with the latest products from the Microsoft stack. Follow us to keep up to date on Best Practises, Tips & Tricks, Revision Guides and plenty more informative content around Dynamics 365 and Power Platform.

More From Medium

More from Capgemini Microsoft Team

More from Capgemini Microsoft Team

More from Capgemini Microsoft Team

More from Capgemini Microsoft Team

The Power of Documentation

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade