Liskov Substitution Principle(LSP)

Ibrahim Yilmaz
3 min readJun 14, 2020
Photo by Danielle MacInnes on Unsplash

I would like to talk about Liskov Substitution Principle in this article and share my daily work experience about it.

I want to start by stating that this is exactly what we learn about Object-Oriented Programming and what we are trying to do in our daily development life.

Do you remember this:

  • Oh have you seen this code? WTF!
  • How have they designed?
  • That abstraction is totally absurd!

These are very common complains against the developer before us. We should not forget that we are that developer before someone and we will be that developer for some company.

But don’t worry! This is the one of the biggest problems in Object Oriented Programming. I want to share my understanding about LSP and try to explain how I try to utilize LSP.

Firstly, I want to ask a question.

  • How can we test/assert our design? or
  • How can we say our design of architecture is correct?

if it was a method we could easily write a unit test like this:

--

--