SOLID Principles - nus-cs2030/2122-s1 GitHub Wiki

S: Single Responsibility Principle

Dear class, you have one job. Do it or we debug you.

O: Open-Closed Principle

"open for extension, closed for modifications"

Can add more classes but abide by the current client implementation.

image

L: Liskov Substitution Principle

The parent class can be replaced by the child class without changing the desired property of the program.

I: Interface Segregation Principle

Clients should not know of methods they don't need. TLDR, mind your own contract (interface). Let other clients do the other contracts.

image

D: Dependency Inversion Principle

Similar to ISP but in a sense that you can only see the contract but not behind the scenes (the implementation).