SOLID exercises

By | February 14, 2020

ćwiczenia SOLID


SOLID principles are basic rules of object-oriented programming. You should not only know them but also practice and use them at work. At first, I remind you of SOLID principles, and then I show you some exercises.

Single responsibility principle

Every class should have only one responsibility (every class should have only one reason to change) — one purpose of existence.

Open/closed principle

All classes should be open for enlargement and closed for modifications.

Liskov substitution principle

The application should work correctly when we put in the base class place every derived class.

Interface segregation principle

Many small and dedicated interfaces are better than few and general.

Dependency inversion principle

High-level modules should not depend on low-level modules, but the dependence should result from abstraction.

SOLID principles exercises

  1. Write code and think about principles.
  2. Sometimes read SOLID principles.
  3. Read code other programmers and look for principles there.
  4. Observe, how your code is changing. If SOLID principles help to handle changes, or they cause bigger problems.
  5. Read code with examples of principles.
  6. Give your code to review and ask reviewer about principles

Check sites with SOLID exercises:

All posts from mini project: Learn SOLID and OOP principles:


Main image


One thought on “SOLID exercises

  1. sbobet

    I was suggested this web site by my cousin. I am not
    sure whether this post is written by him as no one else
    know such detailed about my difficulty. You are incredible!


Leave a Reply

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