The Liskov Substitution Principle (LSP)

If S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the desirable properties of that

Sounds confusing? It sure does to me at least.

Here is an easier version

If you have sub-classed a given class- in that case any program that [...]

Principle of least knowledge

“Only talk to your immediate friends”

Let’s get one thing clear- we are making software- not looking for enlightenment

In Software development- sometimes ignorance can be bliss.
The lesser your class knows- the less complicated it will be.The more it knows- more it has to worry about.

Lets start with an example
I have a class OrderManager. This class is [...]

The Single Responsibility Principle (SRP)

“A class should have only one reason to change.”

Every class exists for  a specific reason. When you design a class- its essential that you know what that reason is and you know it well. And that reason should be the only reason that the class exists and there should be no other reason for that [...]