3
3
What is Inheritance?
• Abstract Class
– define generic behavior
– the abstract super-class defines and may partially
implement the behavior but much of the class is
undefined and unimplemented
– the details are filled in with specialized sub-classes
Inheritance for Conceptually Compatible Classes
• Contract Conformance (Conceptual Inheritance)
• Extension
• Refinement.
Is Kind Of Relationship
Subclass (Derived Class)
Superclass (Base Class)
Inheritance for Pure Extension
• base = {f1(),f2(),f3()}
• Example:
• basestream={read,write,close}
• derivedstream={read,write,close,seek}
Inheritance for Refinement
• base = {f1(),f2(),f3()}
• Example:
– baseStream={read,write,close}
– derivedSafelySharableStream={read,write,close}
automatically locks the stream during an
operation
What Happens to Implementation?
• Inherited method bodies: available as they are,
or replaceable through refinements
Amphi V
Multiple Inheritance (Cont..)
MutualFund
Decomposition (HAS-A) Hierarchy
• Algorithmic decomposition
– System is described as a sequence of steps
(algorithm)
– Each module denotes a major step in the process
– Also known as top-down structured decomposition
• Object Oriented decomposition
– View the world (problem domain) as a set of
autonomous agents that collaborate
– Each Agent “worries” about his job.
– Provides a standard set of services
– May use services of others agents
– Interaction among agents is “Well-defined”.i.e., they
follow a protocol
Algorithm Versus Object-oriented Decomposition
Algorithmic Object -Oriented
• Emphasizes the agents that either (1)
• Highlights the ordering of Cause action (Clients) or (2) Are the
events subjects on which these operations act
• Typically larger systems (Servers)
• Lower reuse •Yields smaller systems through the reuse
•Less resilient and more risky of common mechanisms
to build complex system with •Leverages high reuse
this decomposition. •More resilient to change due to
•Typically flat and unable to underlying stable intermediate forms
reduce complexity •Reduces the risk of buildings complex
•Computing Model is typically software systems because they evolve
von Neumann incrementally (iterative refinement)
•Low concurrency •Directly address the inherent complexity
of software by using the separation of
concerns in a large state space
•Computing Model is Client-Server
•Inherently distributed; High concurrency