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
10. chi
• Admin is a user
• can be implemented via has-a:
Everyone has Brokeback Mountain in mind
child
11. • Type A inherit TypeB: TypeA is a (special case of) TypeB
• TypeSubClass (TypeDerivedClass or ChildClass) inherit
TypeSuperClass (TypeBaseClass or ParentClass)
14. Uses of Is-A
• CassettePlayer is a (concrete type of) Player
• CDPlayer is a (concrete type of) Player
15. Uses of Is-A
• CDplayer is a (update of) CassettePlayer
• some behaviors “changed”
• no as clear as the previous case, but a potential trick
in OOP
19. Is-A
• is an extended type of
- FunPerson is Person who can tell jokes
• is a more concrete/restricted description of
- YoungPerson is Person who is young
• (is an update of)
- NewStaff replaces ExistingStaff
20.
21. • Over-use of inherit for is-a: 1 class -> 1 instance
• Usual goal of OOP: one class, many instances
22. Is-A
• Under-user of inherit for is-a: overly complicated class
YowooStaff
• Bugs/hacks?
cali = YowooStaff(id: “”, name: “CYLi”, title: “CFO”)