Types and inheritance
\comment{See [HOB87].}
\sly{types}{
O{\rm bject} O{\rm riented} M{\rm ethodology}
\nl
{\footnotesize
increases programmer
productivity by enhancing software maintainability, extensibility and
reusability !
}
- types -- major organizing principle in OO
- inheritance -- to specify relations between types
OOP $\stackrel{blurs}{=}$ design + implementation
- types provide natural basis for modularization
{\bf Well designed type structure:} minimize and localize
dependencies among types !
}
\sli{
{\bf Object = state + behavior}
- computation is sending messages
Subtyping
- if then
Inheritance ( type hierarchy graph )
- code sharing (storage representation + operations)
overriding, virtual functions / methods\n
{\bf Protection:} private, public, protected
\n
}
\sli{
Type = objects with similar behavior
- partial types are designed to have subtypes
super type: \fbox{{\bf interface}}\n
implementation is left to subtypes
Where to put functionality?
- factor out code (building blocks)
reusability -- how useful is the code?\n
complexity -- how difficult to implement?\n
applicability -- how relevant to the type?\n
implementation -- how dependent?
\n
}
\sli{
Subtyping (design methodology)
- stepwise refinement by specialization
{\footnotesize C.f. decomposition : (data/procedural abstraction)}
\nl
Specialization -- conceptual hierarchies\n
Implementation -- to realize a supertype\n
Combination -- multiple inheritance
Nonstandard subtyping:\n
Generalization -- e.g. \n
Variance -- e.g. {\it Mouse Tablet} [Pointing]\n
Limitation -- e.g. {\it Deque Stack }
\nln
{\footnotesize {\bf } Creativity and clear headed thinking are the most important ingredients of design } !
\n
}