1. Object Oriented Programming
in Swift
Ch 3
Single Responsibility Principle
Dependency Inversion Principle
Interface Segregation Principle
Sai Li @ Yowoo Tech.
2016/1/9
2. References
• Agile Software Development: Principles, Patterns,
and Practice ( : )
by Robert C. Martin
• Fundamental Object Oriented Programming
by Hsuan-Tien Lin
•
by Teddy Chen
• Essential Object-Oriented Programming
by Josh Ko
18. Dependency Inversion Principle
1. High-level modules should not depend on low-
level modules.
Both should depend on abstractions
2. Abstractions should not depend on details. Details
should depend on abstractions.
33. “Fat” Interface
• More than one responsibility
• Coupled responsibilities
• Fragile Design
• Clients depend on what they need only
34. Recap
• SRP: A class should have one, and only one, reason to change.
• DIP: Depend on abstractions, not on concretions.
• ISP: Make fine grained interfaces that are client specific