Lect 6 Solid Examples
Lect 6 Solid Examples
Mónica Rodrigues
Degree in Computer Science Engineer at ISEL
S O L I D
SRP OCP LSP ISP DIP
Single Liskovs Interface Dependency
Open/Closed
Responsibility Substitution Segregation Inversion
Principle
Principle Principle Principle Principle
Single Responsibility Principle
Business logic
Persistence
Humm...and if I need to
add a new payment type?
close for
modification
Liskov Substitution Principle
Much better
Interface Segregation Principle
WHY?????
I don’t need you!!
Interface Segregation Principle
So, I create an
interface and now?
Dependency Inversion Principle
Dependency Inversion Principle
Constructor injection:
Dependency Inversion Principle
Property injection:
Dependency Inversion Principle
Method injection:
Keep in mind