SlideShare uma empresa Scribd logo
1 de 38
UsingUML,Patterns,andJava
Object-OrientedSoftwareEngineering
Chapter 8, Object Design:
Reuse and Patterns
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
2
Object Design
• Purpose of object design:
• Prepare for the implementation of the system model
based on design decisions
• Transform the system model (optimize it)
• Investigate alternative ways to implement the
system model
• Use design goals: minimize execution time, memory
and other measures of cost.
• Object design serves as the basis of
implementation.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
3
Terminology: Naming of Design Activities
Methodology: Object-oriented software engineering
(OOSE)
• System Design
• Decomposition into subsystems, etc
• Object Design
• Data structures and algorithms chosen
• Implementation
• Implementation language is chosen
System Development as a Set of Activities
Custom objects
Analysis
- System Design
- Object Design
System Model
Design
Application objects
Solution objects
Existing Machine
Problem
Off-the-Shelf Components
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
5
Object Design consists of 4 Activities
1. Reuse: Identification of existing solutions
• Use of inheritance
• Off-the-shelf components and
additional solution objects
• Design patterns
2. Interface specification
• Describes precisely each class interface
3. Object model restructuring
• Transforms the object design model to
improve its understandability and extensibility
4. Object model optimization
• Transforms the object design model to address
performance criteria such as response
time or memory utilization.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
6
Object Design Activities
Specifying constraints
Specifying types &
signatures
Identifying patterns
Adjusting patterns
Identifying missing
attributes & operations
Specifying visibility
Specification
Specifying exceptions
Reuse
Identifying components
Adjusting components
Select Subsystem
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
7
Detailed View of Object Design Activities
(ctd)
Collapsing classes
Restructuring Optimization
Revisiting
inheritance
Optimizing access
paths
Caching complex
computations
Delaying complex
computations
Check Use Cases
Realizing associations
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
8
One Way to do Object Design
1. Identify the missing components in the design gap
2. Make a build or buy decision to obtain the missing
component
=> Component-Based Software Engineering:
The design gap is filled with available
components (“0 % coding”).
• Special Case: COTS-Development
• COTS: Commercial-off-the-Shelf
• The design gap is completely filled with commercial-
off-the-shelf-components.
=> Design with standard components.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
9
Identification of new Objects during Object
Design
Incident
Report
Requirements Analysis
(Language of Application
Domain)
Object Design
(Language of Solution
Domain)
Incident
Report
Text box Menu Scrollbar
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
10
Application Domain vs Solution Domain Objects
Requirements Analysis (Language of Application Domain)
Subject
subscribe(subscriber)
unsubscribe(subscriber)
notify()
update()
Observer
*observers
Object Design (Language of Solution Domain)
ConcreteSubject
state
getState()
setState()
ConcreteObserver
observeState
update()
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
11
Other Reasons for new Objects
• The implementation of algorithms may
necessitate objects to hold values
• New low-level operations may be needed during
the decomposition of high-level operations
• Example: EraseArea() in a drawing program
• Conceptually very simple
• Implementation is complicated:
• Area represented by pixels
• We need a Repair() operation to clean up objects
partially covered by the erased area
• We need a Redraw() operation to draw objects
uncovered by the erasure
• We need a Draw() operation to erase pixels in
background color not covered by other objects.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
12
Modeling of the Real World
• Modeling of the real world leads to a system that
reflects today’s realities but not necessarily
tomorrow’s.
• There is a need for reusable and flexible designs
• Design knowledge such as the adapter pattern
complements application domain knowledge and
solution domain knowledge.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
13
Reuse of Code
• I have a list, but my customer would like to have a
stack
• The list offers the operations Insert(), Find(), Delete()
• The stack needs the operations Push(), Pop() and Top()
• Can I reuse the existing list?
• I am an employee in a company that builds cars
with expensive car stereo systems
• Can I reuse the existing car software in a home stero
system?
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
14
Reuse of Interfaces
• I am an off-shore programmer in Hawaii. I have a
contract to implement an electronic parts catalog
for DaimlerChrysler
• How can I and my contractor be sure that I implement it
correctly?
• I would like to develop a window system for Linux
that behaves the same way as in Vista
• How can I make sure that I follow the conventions for
Vista windows and not those of MacOS X?
• I have to develop a new service for cars, that
automatically call a help center when the car is
used the wrong way.
• Can I reuse the help desk software that I developed for a
company in the telecommuniction industry?
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
15
Reuse of existing classes
• I have an implementation for a list of elements
of Typ int
• Can I reuse this list to build
• a list of customers
• a spare parts catalog
• a flight reservation schedule?
• I have developed a class “Addressbook” in
another project
• Can I add it as a subsystem to my e-mail program
which I purchased from a vendor (replacing the
vendor-supplied addressbook)?
• Can I reuse this class in the billing software of my
dealer management system?
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
16
Customization: Build Custom Objects
• Problem: Close the object design gap
• Develop new functionality
• Main goal:
• Reuse knowledge from previous experience
• Reuse functionality already available
• Composition (also called Black Box Reuse)
• New functionality is obtained by aggregation
• The new object with more functionality is an
aggregation of existing objects
• Inheritance (also called White-box Reuse)
• New functionality is obtained by inheritance
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
17
The use of Inheritance
• Inheritance is used to achieve two different goals
• Description of Taxonomies
• Interface Specification
• Description of Taxonomies
• Used during requirements analysis
• Activity: identify application domain objects that are
hierarchically related
• Goal: make the analysis model more understandable
• Interface Specification
• Used during object design
• Activity: identify the signatures of all identified objects
• Goal: increase reusability, enhance modifiability and
extensibility
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
18
Example of Inheritance
Superclass:
drive()
brake()
accelerate()
Car
playMusic()
ejectCD()
resumeMusic()
pauseMusic()
LuxuryCar
Subclass:
public class LuxuryCar extends Car
{
public void playMusic() {…}
public void ejectCD() {…}
public void resumeMusic() {…}
public void pauseMusic() {…}
}
public class Car {
public void drive() {…}
public void brake() {…}
public void accelerate() {…}
}
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
19
Inheritance comes in many Flavors
Inheritance is used in four ways:
• Specialization
• Generalization
• Specification Inheritance
• Implementation Inheritance.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
20
Discovering Inheritance
• To “discover“ inheritance associations, we can
proceed in two ways, which we call specialization
and generalization
• Generalization: the discovery of an inheritance
relationship between two classes, where the sub
class is discovered first.
• Specialization: the discovery of an inheritance
relationship between two classes, where the
super class is discovered first.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
21
Generalization
• First we find the subclass, then the super class
• This type of discovery occurs often in science
and engineering:
• Biology: First we find individual animals (Elefant, Lion,
Tiger), then we discover that these animals have
common properties (mammals).
Generalization Example: Modeling a
Coffee Machine
totalReceipts
numberOfCups
coffeeMix
collectMoney()
makeChange()
heatWater()
dispenseBeverage()
addSugar()
addCreamer()
CoffeeMachine
VendingMachine
Generalization:
The class CoffeeMachine is
discovered first, then the class
SodaMachine, then the
superclass
VendingMachine
totalReceipts
cansOfBeer
cansOfCola
collectMoney()
makeChange()
chill()
dispenseBeverage()
SodaMachine
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
23
Restructuring of Attributes and Operations
is often a Consequence of Generalization
totalReceipts
collectMoney()
makeChange()
dispenseBeverage()
VendingMachine
numberOfCups
coffeeMix
heatWater()
addSugar()
addCreamer()
CoffeeMachine
cansOfBeer
cansOfCola
chill()
SodaMachine
totalReceipts
numberOfCups
coffeeMix
collectMoney()
makeChange()
heatWater()
dispenseBeverage()
addSugar()
addCreamer()
CoffeeMachine
VendingMachine
totalReceipts
cansOfBeer
cansOfCola
collectMoney()
makeChange()
chill()
dispenseBeverage()
SodaMachine
Called Remodeling if done on
the model level;
Called Refactoring if done on
the source code level.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
24
An Example of a Specialization
numberOfCups
coffeeMix
heatWater()
addSugar()
addCreamer()
CoffeeMachine
totalReceipts
collectMoney()
makeChange()
dispenseBeverage()
VendingMachine
cansOfBeer
cansOfCola
chill()
SodaMachine
bagsofChips
numberOfCandyBars
dispenseSnack()
CandyMachine
CandyMachine is a new
product and designed as a sub
class of the superclass
VendingMachine
A change of names might now
be useful: dispenseItem()
instead of
dispenseBeverage()
and
dispenseSnack()
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
25
Example of a Specialization (2)
numberOfCups
coffeeMix
heatWater()
addSugar()
addCreamer()
dispenseItem()
CoffeeMachine
totalReceipts
collectMoney()
makeChange()
dispenseItem()
VendingMaschine
cansOfBeer
cansOfCola
chill()
dispenseItem()
SodaMachine
bagsofChips
numberOfCandyBars
dispenseItem()
CandyMachine
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
26
Meta-Model for Inheritance
Inheritance
Specification
Inheritance
Implementation
Inheritance
Inheritance
for ReuseTaxonomy
Inheritance
detected by
generalization
Inheritance
detected by
specialization
Analysis
activity
Object
Design
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
27
For Reuse: Implementation Inheritance and
Specification Inheritance
• Implementation inheritance
• Also called class inheritance
• Goal:
• Extend an applications’ functionality by reusing
functionality from the super class
• Inherit from an existing class with some or all
operations already implemented
• Specification Inheritance
• Also called subtyping
• Goal:
• Inherit from a specification
• The specification is an abstract class with all
operations specified, but not yet implemented.
Problem with implementation inheritance:
• The inherited operations might exhibit unwanted behavior.
• Example: What happens if the Stack user calls Remove()
instead of Pop()?
Example:
• I have a List class, I need a
Stack class
• How about subclassing the
Stack class from the List
class and implementing
Push(), Pop(), Top() with
Add() and Remove()?
Add()
Remove()
List
Push()
Pop()
Stack
Top()
“Already
implemented”
Example for Implementation Inheritance
• A very similar class is already implemented that
does almost the same as the desired class
implementation
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
29
Delegation instead of Implementation
Inheritance
• Inheritance: Extending a Base class by a new
operation or overriding an operation.
• Delegation: Catching an operation and sending it
to another object.
• Which of the following models is better?
+Add()
+Remove()
List
Stack
+Push()
+Pop()
+Top()
+Push()
+Pop()
+Top()
Stack
Add()
Remove()
List
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
30
delegates toClient Receiver Delegate
calls
Delegation
• Delegation is a way of making composition as
powerful for reuse as inheritance
• In delegation two objects are involved in
handling a request from a Client
•The Receiver object delegates operations to
the Delegate object
•The Receiver object makes sure, that the
Client does not misuse the Delegate object.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
31
Adapter Pattern
• Adapter Pattern: Connects incompatible
components.
• It converts the interface of one component into
another interface expected by the other (calling)
component
• Used to provide a new interface to existing legacy
components (Interface engineering, reengineering)
• Also known as a wrapper.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
32
Adapter Pattern
ClientInterface
Request()
LegacyClass
ExistingRequest()
adaptee
Adapter
Request()
Client
Old System
(“Legacy System”)
New System
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
33
Adapter for the Set problem
Set
add(element)
adaptee
MySet
add(element)
Client
Hashtable
put(key, element)
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
34
Contraction
• Contraction: Implementations of methods in
the super class are overwritten with empty
bodies in the subclass to make the super class
operations “invisible“
• Contraction is a special type of inheritance
• It should be avoided at all costs, but is used
often.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
35
Revised Metamodel for Inheritance
Inheritance
Specification
Inheritance
Implementation
Inheritance
Inheritance
for ReuseTaxonomy
Inheritance
detected by
generalization
Inheritance
detected by
specialization
Analysis
activity
Object
Design
Strict
Inheritance Contraction
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
36
Documenting Object Design: ODD
Conventions
• Each subsystem in a system provides a service
• Describes the set of operations provided by the
subsystem
• Specification of the service operations
• Signature: Name of operation, fully typed parameter
list and return type
• Abstract: Describes the operation
• Pre: Precondition for calling the operation
• Post: Postcondition describing important state after the
execution of the operation
• Use JavaDoc and Contracts for the specification
of service operations
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
37
Package it all up
• Pack up design into discrete units that can be
edited, compiled, linked, reused
• Construct physical modules
• Ideally use one package for each subsystem
• System decomposition might not be good for
implementation.
• Two design principles for packaging
• Minimize coupling:
• Classes in client-supplier relationships are usually
loosely coupled
• Avoid large number of parameters in methods to
avoid strong coupling (should be less than 4-5)
• Avoid global data
• Maximize cohesion: Put classes connected by
associations into one package.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java
38
Packaging Heuristics
• Each subsystem service is made available by
one or more interface objects within the package
• Start with one interface object for each
subsystem service
• Try to limit the number of interface operations (7+-2)
• If an interface object has too many operations,
reconsider the number of interface objects
• If you have too many interface objects,
reconsider the number of subsystems
• Interface objects vs Java interface:
• Interface object: Used during requirements analysis,
system design, object design. Denotes a service or API
• Java interface: Used during implementation in Java
(May or may not implement an interface object).

Mais conteúdo relacionado

Mais procurados

Design patterns structuralpatterns(theadapterpattern)
Design patterns structuralpatterns(theadapterpattern)Design patterns structuralpatterns(theadapterpattern)
Design patterns structuralpatterns(theadapterpattern)APU
 
Generative Software Development. Overview and Examples
Generative Software Development. Overview and ExamplesGenerative Software Development. Overview and Examples
Generative Software Development. Overview and ExamplesEelco Visser
 
Design pattern
Design patternDesign pattern
Design patternOmar Isaid
 
Software design patterns ppt
Software design patterns pptSoftware design patterns ppt
Software design patterns pptmkruthika
 
Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)stanbridge
 

Mais procurados (15)

Ch04lect1 ud
Ch04lect1 udCh04lect1 ud
Ch04lect1 ud
 
Ch07lect1 ud
Ch07lect1 udCh07lect1 ud
Ch07lect1 ud
 
Ch03lect1 ud
Ch03lect1 udCh03lect1 ud
Ch03lect1 ud
 
Ch06lect1 ud
Ch06lect1 udCh06lect1 ud
Ch06lect1 ud
 
Ch05lect1 ud
Ch05lect1 udCh05lect1 ud
Ch05lect1 ud
 
Ch01lect1 ud
Ch01lect1 udCh01lect1 ud
Ch01lect1 ud
 
Ch02lect1 ud
Ch02lect1 udCh02lect1 ud
Ch02lect1 ud
 
Design patterns structuralpatterns(theadapterpattern)
Design patterns structuralpatterns(theadapterpattern)Design patterns structuralpatterns(theadapterpattern)
Design patterns structuralpatterns(theadapterpattern)
 
Generative Software Development. Overview and Examples
Generative Software Development. Overview and ExamplesGenerative Software Development. Overview and Examples
Generative Software Development. Overview and Examples
 
Design pattern
Design patternDesign pattern
Design pattern
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
08 component level_design
08 component level_design08 component level_design
08 component level_design
 
Software design patterns ppt
Software design patterns pptSoftware design patterns ppt
Software design patterns ppt
 
Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)
 
myslide1
myslide1myslide1
myslide1
 

Destaque

Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering conceptsKomal Singh
 
ASP.NET System design 2
ASP.NET System design 2ASP.NET System design 2
ASP.NET System design 2Sisir Ghosh
 
Abbott's Textual Analysis : Software Engineering 2
Abbott's Textual Analysis : Software Engineering 2Abbott's Textual Analysis : Software Engineering 2
Abbott's Textual Analysis : Software Engineering 2wahab13
 
Object Modeling with UML: Behavioral Modeling
Object Modeling with UML: Behavioral ModelingObject Modeling with UML: Behavioral Modeling
Object Modeling with UML: Behavioral Modelingelliando dias
 
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...Isuru Perera
 
final thisis 2016,Ahmed Alsenosy,BPCPM of applying PMI Module in construction...
final thisis 2016,Ahmed Alsenosy,BPCPM of applying PMI Module in construction...final thisis 2016,Ahmed Alsenosy,BPCPM of applying PMI Module in construction...
final thisis 2016,Ahmed Alsenosy,BPCPM of applying PMI Module in construction...Ahmed Al-Senosy Ph.D(cand),MSc,PMP,RMP
 
Texture mapping
Texture mapping Texture mapping
Texture mapping wahab13
 
Object Oriented Software Engineering
Object Oriented Software EngineeringObject Oriented Software Engineering
Object Oriented Software EngineeringAli Haider
 
Online recruitment system
Online recruitment systemOnline recruitment system
Online recruitment systemKomal Singh
 
2-Software Design (Object Oriented Software Engineering - BNU Spring 2017)
2-Software Design (Object Oriented Software Engineering - BNU Spring 2017)2-Software Design (Object Oriented Software Engineering - BNU Spring 2017)
2-Software Design (Object Oriented Software Engineering - BNU Spring 2017)Hafiz Ammar Siddiqui
 
3-Software Anti Design Patterns (Object Oriented Software Engineering - BNU S...
3-Software Anti Design Patterns (Object Oriented Software Engineering - BNU S...3-Software Anti Design Patterns (Object Oriented Software Engineering - BNU S...
3-Software Anti Design Patterns (Object Oriented Software Engineering - BNU S...Hafiz Ammar Siddiqui
 

Destaque (13)

organization charts....rules
organization charts....rulesorganization charts....rules
organization charts....rules
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering concepts
 
ASP.NET System design 2
ASP.NET System design 2ASP.NET System design 2
ASP.NET System design 2
 
Ch05lect2 ud
Ch05lect2 udCh05lect2 ud
Ch05lect2 ud
 
Abbott's Textual Analysis : Software Engineering 2
Abbott's Textual Analysis : Software Engineering 2Abbott's Textual Analysis : Software Engineering 2
Abbott's Textual Analysis : Software Engineering 2
 
Object Modeling with UML: Behavioral Modeling
Object Modeling with UML: Behavioral ModelingObject Modeling with UML: Behavioral Modeling
Object Modeling with UML: Behavioral Modeling
 
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
Unified Modeling Language (UML), Object-Oriented Programming Concepts & Desig...
 
final thisis 2016,Ahmed Alsenosy,BPCPM of applying PMI Module in construction...
final thisis 2016,Ahmed Alsenosy,BPCPM of applying PMI Module in construction...final thisis 2016,Ahmed Alsenosy,BPCPM of applying PMI Module in construction...
final thisis 2016,Ahmed Alsenosy,BPCPM of applying PMI Module in construction...
 
Texture mapping
Texture mapping Texture mapping
Texture mapping
 
Object Oriented Software Engineering
Object Oriented Software EngineeringObject Oriented Software Engineering
Object Oriented Software Engineering
 
Online recruitment system
Online recruitment systemOnline recruitment system
Online recruitment system
 
2-Software Design (Object Oriented Software Engineering - BNU Spring 2017)
2-Software Design (Object Oriented Software Engineering - BNU Spring 2017)2-Software Design (Object Oriented Software Engineering - BNU Spring 2017)
2-Software Design (Object Oriented Software Engineering - BNU Spring 2017)
 
3-Software Anti Design Patterns (Object Oriented Software Engineering - BNU S...
3-Software Anti Design Patterns (Object Oriented Software Engineering - BNU S...3-Software Anti Design Patterns (Object Oriented Software Engineering - BNU S...
3-Software Anti Design Patterns (Object Oriented Software Engineering - BNU S...
 

Semelhante a Ch08lect1 ud

L14_DesignGoalsSubsystemDecompositionc_ch06lect1.ppt
L14_DesignGoalsSubsystemDecompositionc_ch06lect1.pptL14_DesignGoalsSubsystemDecompositionc_ch06lect1.ppt
L14_DesignGoalsSubsystemDecompositionc_ch06lect1.pptAronBalais1
 
L14_DesignGoalsSubsystemDecompositionc_ch06lect1.ppt
L14_DesignGoalsSubsystemDecompositionc_ch06lect1.pptL14_DesignGoalsSubsystemDecompositionc_ch06lect1.ppt
L14_DesignGoalsSubsystemDecompositionc_ch06lect1.pptAxmedMaxamuud6
 
OOSE Ch1 Introduction
OOSE Ch1 IntroductionOOSE Ch1 Introduction
OOSE Ch1 IntroductionBenny Chen
 
L35_LifecycleModeling_ch15lect1.ppt
L35_LifecycleModeling_ch15lect1.pptL35_LifecycleModeling_ch15lect1.ppt
L35_LifecycleModeling_ch15lect1.pptgarimaarora436394
 
L35_LifecycleModeling_ch15lect1.ppt
L35_LifecycleModeling_ch15lect1.pptL35_LifecycleModeling_ch15lect1.ppt
L35_LifecycleModeling_ch15lect1.pptSaraj Hameed Sidiqi
 
Software Engineering Lec 2
Software Engineering Lec 2Software Engineering Lec 2
Software Engineering Lec 2Taymoor Nazmy
 
Lecture 1 uml with java implementation
Lecture 1 uml with java implementationLecture 1 uml with java implementation
Lecture 1 uml with java implementationthe_wumberlog
 
L30_Project_Organization_ch13lect1.ppt
L30_Project_Organization_ch13lect1.pptL30_Project_Organization_ch13lect1.ppt
L30_Project_Organization_ch13lect1.pptDheerajMehlawat2
 
OOAD-Unit1.ppt
OOAD-Unit1.pptOOAD-Unit1.ppt
OOAD-Unit1.pptrituah
 
Chap 6 - Software Architecture Part 1.ppt
Chap 6 - Software Architecture Part 1.pptChap 6 - Software Architecture Part 1.ppt
Chap 6 - Software Architecture Part 1.pptkhalidnawaz39
 
Chap 6 - Software Architecture Part 1.pptx
Chap 6 - Software Architecture Part 1.pptxChap 6 - Software Architecture Part 1.pptx
Chap 6 - Software Architecture Part 1.pptxssuser0ed5b4
 
Configuring in the Browser, Really!
Configuring in the Browser, Really!Configuring in the Browser, Really!
Configuring in the Browser, Really!Tim Geisler
 
Discrete Event Simulation, CASE tool built using C#
Discrete Event Simulation, CASE tool built using C#Discrete Event Simulation, CASE tool built using C#
Discrete Event Simulation, CASE tool built using C#Ron Perlmuter
 
Intro to C++ - Class 2 - Objects & Classes
Intro to C++ - Class 2 - Objects & ClassesIntro to C++ - Class 2 - Objects & Classes
Intro to C++ - Class 2 - Objects & ClassesBlue Elephant Consulting
 
Intro To C++ - Class 2 - An Introduction To C++
Intro To C++ - Class 2 - An Introduction To C++Intro To C++ - Class 2 - An Introduction To C++
Intro To C++ - Class 2 - An Introduction To C++Blue Elephant Consulting
 

Semelhante a Ch08lect1 ud (20)

L14_DesignGoalsSubsystemDecompositionc_ch06lect1.ppt
L14_DesignGoalsSubsystemDecompositionc_ch06lect1.pptL14_DesignGoalsSubsystemDecompositionc_ch06lect1.ppt
L14_DesignGoalsSubsystemDecompositionc_ch06lect1.ppt
 
L14_DesignGoalsSubsystemDecompositionc_ch06lect1.ppt
L14_DesignGoalsSubsystemDecompositionc_ch06lect1.pptL14_DesignGoalsSubsystemDecompositionc_ch06lect1.ppt
L14_DesignGoalsSubsystemDecompositionc_ch06lect1.ppt
 
Lo 11
Lo 11Lo 11
Lo 11
 
ch01lect1.ppt
ch01lect1.pptch01lect1.ppt
ch01lect1.ppt
 
OOSE Ch1 Introduction
OOSE Ch1 IntroductionOOSE Ch1 Introduction
OOSE Ch1 Introduction
 
L35_LifecycleModeling_ch15lect1.ppt
L35_LifecycleModeling_ch15lect1.pptL35_LifecycleModeling_ch15lect1.ppt
L35_LifecycleModeling_ch15lect1.ppt
 
L35_LifecycleModeling_ch15lect1.ppt
L35_LifecycleModeling_ch15lect1.pptL35_LifecycleModeling_ch15lect1.ppt
L35_LifecycleModeling_ch15lect1.ppt
 
Software Engineering Lec 2
Software Engineering Lec 2Software Engineering Lec 2
Software Engineering Lec 2
 
OOSE-UNIT-1.pptx
OOSE-UNIT-1.pptxOOSE-UNIT-1.pptx
OOSE-UNIT-1.pptx
 
Lecture 1 uml with java implementation
Lecture 1 uml with java implementationLecture 1 uml with java implementation
Lecture 1 uml with java implementation
 
L30_Project_Organization_ch13lect1.ppt
L30_Project_Organization_ch13lect1.pptL30_Project_Organization_ch13lect1.ppt
L30_Project_Organization_ch13lect1.ppt
 
OOAD-Unit1.ppt
OOAD-Unit1.pptOOAD-Unit1.ppt
OOAD-Unit1.ppt
 
Chap 6 - Software Architecture Part 1.ppt
Chap 6 - Software Architecture Part 1.pptChap 6 - Software Architecture Part 1.ppt
Chap 6 - Software Architecture Part 1.ppt
 
Chap 6 - Software Architecture Part 1.pptx
Chap 6 - Software Architecture Part 1.pptxChap 6 - Software Architecture Part 1.pptx
Chap 6 - Software Architecture Part 1.pptx
 
Configuring in the Browser, Really!
Configuring in the Browser, Really!Configuring in the Browser, Really!
Configuring in the Browser, Really!
 
Discrete Event Simulation, CASE tool built using C#
Discrete Event Simulation, CASE tool built using C#Discrete Event Simulation, CASE tool built using C#
Discrete Event Simulation, CASE tool built using C#
 
CodeBook at the Conferences
CodeBook at the ConferencesCodeBook at the Conferences
CodeBook at the Conferences
 
Unit 1
Unit 1Unit 1
Unit 1
 
Intro to C++ - Class 2 - Objects & Classes
Intro to C++ - Class 2 - Objects & ClassesIntro to C++ - Class 2 - Objects & Classes
Intro to C++ - Class 2 - Objects & Classes
 
Intro To C++ - Class 2 - An Introduction To C++
Intro To C++ - Class 2 - An Introduction To C++Intro To C++ - Class 2 - An Introduction To C++
Intro To C++ - Class 2 - An Introduction To C++
 

Ch08lect1 ud

  • 2. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 2 Object Design • Purpose of object design: • Prepare for the implementation of the system model based on design decisions • Transform the system model (optimize it) • Investigate alternative ways to implement the system model • Use design goals: minimize execution time, memory and other measures of cost. • Object design serves as the basis of implementation.
  • 3. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 3 Terminology: Naming of Design Activities Methodology: Object-oriented software engineering (OOSE) • System Design • Decomposition into subsystems, etc • Object Design • Data structures and algorithms chosen • Implementation • Implementation language is chosen
  • 4. System Development as a Set of Activities Custom objects Analysis - System Design - Object Design System Model Design Application objects Solution objects Existing Machine Problem Off-the-Shelf Components
  • 5. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 5 Object Design consists of 4 Activities 1. Reuse: Identification of existing solutions • Use of inheritance • Off-the-shelf components and additional solution objects • Design patterns 2. Interface specification • Describes precisely each class interface 3. Object model restructuring • Transforms the object design model to improve its understandability and extensibility 4. Object model optimization • Transforms the object design model to address performance criteria such as response time or memory utilization.
  • 6. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 6 Object Design Activities Specifying constraints Specifying types & signatures Identifying patterns Adjusting patterns Identifying missing attributes & operations Specifying visibility Specification Specifying exceptions Reuse Identifying components Adjusting components Select Subsystem
  • 7. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 7 Detailed View of Object Design Activities (ctd) Collapsing classes Restructuring Optimization Revisiting inheritance Optimizing access paths Caching complex computations Delaying complex computations Check Use Cases Realizing associations
  • 8. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 8 One Way to do Object Design 1. Identify the missing components in the design gap 2. Make a build or buy decision to obtain the missing component => Component-Based Software Engineering: The design gap is filled with available components (“0 % coding”). • Special Case: COTS-Development • COTS: Commercial-off-the-Shelf • The design gap is completely filled with commercial- off-the-shelf-components. => Design with standard components.
  • 9. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 9 Identification of new Objects during Object Design Incident Report Requirements Analysis (Language of Application Domain) Object Design (Language of Solution Domain) Incident Report Text box Menu Scrollbar
  • 10. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 10 Application Domain vs Solution Domain Objects Requirements Analysis (Language of Application Domain) Subject subscribe(subscriber) unsubscribe(subscriber) notify() update() Observer *observers Object Design (Language of Solution Domain) ConcreteSubject state getState() setState() ConcreteObserver observeState update()
  • 11. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 11 Other Reasons for new Objects • The implementation of algorithms may necessitate objects to hold values • New low-level operations may be needed during the decomposition of high-level operations • Example: EraseArea() in a drawing program • Conceptually very simple • Implementation is complicated: • Area represented by pixels • We need a Repair() operation to clean up objects partially covered by the erased area • We need a Redraw() operation to draw objects uncovered by the erasure • We need a Draw() operation to erase pixels in background color not covered by other objects.
  • 12. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 12 Modeling of the Real World • Modeling of the real world leads to a system that reflects today’s realities but not necessarily tomorrow’s. • There is a need for reusable and flexible designs • Design knowledge such as the adapter pattern complements application domain knowledge and solution domain knowledge.
  • 13. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 13 Reuse of Code • I have a list, but my customer would like to have a stack • The list offers the operations Insert(), Find(), Delete() • The stack needs the operations Push(), Pop() and Top() • Can I reuse the existing list? • I am an employee in a company that builds cars with expensive car stereo systems • Can I reuse the existing car software in a home stero system?
  • 14. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 14 Reuse of Interfaces • I am an off-shore programmer in Hawaii. I have a contract to implement an electronic parts catalog for DaimlerChrysler • How can I and my contractor be sure that I implement it correctly? • I would like to develop a window system for Linux that behaves the same way as in Vista • How can I make sure that I follow the conventions for Vista windows and not those of MacOS X? • I have to develop a new service for cars, that automatically call a help center when the car is used the wrong way. • Can I reuse the help desk software that I developed for a company in the telecommuniction industry?
  • 15. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 15 Reuse of existing classes • I have an implementation for a list of elements of Typ int • Can I reuse this list to build • a list of customers • a spare parts catalog • a flight reservation schedule? • I have developed a class “Addressbook” in another project • Can I add it as a subsystem to my e-mail program which I purchased from a vendor (replacing the vendor-supplied addressbook)? • Can I reuse this class in the billing software of my dealer management system?
  • 16. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 16 Customization: Build Custom Objects • Problem: Close the object design gap • Develop new functionality • Main goal: • Reuse knowledge from previous experience • Reuse functionality already available • Composition (also called Black Box Reuse) • New functionality is obtained by aggregation • The new object with more functionality is an aggregation of existing objects • Inheritance (also called White-box Reuse) • New functionality is obtained by inheritance
  • 17. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 17 The use of Inheritance • Inheritance is used to achieve two different goals • Description of Taxonomies • Interface Specification • Description of Taxonomies • Used during requirements analysis • Activity: identify application domain objects that are hierarchically related • Goal: make the analysis model more understandable • Interface Specification • Used during object design • Activity: identify the signatures of all identified objects • Goal: increase reusability, enhance modifiability and extensibility
  • 18. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 18 Example of Inheritance Superclass: drive() brake() accelerate() Car playMusic() ejectCD() resumeMusic() pauseMusic() LuxuryCar Subclass: public class LuxuryCar extends Car { public void playMusic() {…} public void ejectCD() {…} public void resumeMusic() {…} public void pauseMusic() {…} } public class Car { public void drive() {…} public void brake() {…} public void accelerate() {…} }
  • 19. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 19 Inheritance comes in many Flavors Inheritance is used in four ways: • Specialization • Generalization • Specification Inheritance • Implementation Inheritance.
  • 20. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 20 Discovering Inheritance • To “discover“ inheritance associations, we can proceed in two ways, which we call specialization and generalization • Generalization: the discovery of an inheritance relationship between two classes, where the sub class is discovered first. • Specialization: the discovery of an inheritance relationship between two classes, where the super class is discovered first.
  • 21. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 21 Generalization • First we find the subclass, then the super class • This type of discovery occurs often in science and engineering: • Biology: First we find individual animals (Elefant, Lion, Tiger), then we discover that these animals have common properties (mammals).
  • 22. Generalization Example: Modeling a Coffee Machine totalReceipts numberOfCups coffeeMix collectMoney() makeChange() heatWater() dispenseBeverage() addSugar() addCreamer() CoffeeMachine VendingMachine Generalization: The class CoffeeMachine is discovered first, then the class SodaMachine, then the superclass VendingMachine totalReceipts cansOfBeer cansOfCola collectMoney() makeChange() chill() dispenseBeverage() SodaMachine
  • 23. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 23 Restructuring of Attributes and Operations is often a Consequence of Generalization totalReceipts collectMoney() makeChange() dispenseBeverage() VendingMachine numberOfCups coffeeMix heatWater() addSugar() addCreamer() CoffeeMachine cansOfBeer cansOfCola chill() SodaMachine totalReceipts numberOfCups coffeeMix collectMoney() makeChange() heatWater() dispenseBeverage() addSugar() addCreamer() CoffeeMachine VendingMachine totalReceipts cansOfBeer cansOfCola collectMoney() makeChange() chill() dispenseBeverage() SodaMachine Called Remodeling if done on the model level; Called Refactoring if done on the source code level.
  • 24. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 24 An Example of a Specialization numberOfCups coffeeMix heatWater() addSugar() addCreamer() CoffeeMachine totalReceipts collectMoney() makeChange() dispenseBeverage() VendingMachine cansOfBeer cansOfCola chill() SodaMachine bagsofChips numberOfCandyBars dispenseSnack() CandyMachine CandyMachine is a new product and designed as a sub class of the superclass VendingMachine A change of names might now be useful: dispenseItem() instead of dispenseBeverage() and dispenseSnack()
  • 25. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 25 Example of a Specialization (2) numberOfCups coffeeMix heatWater() addSugar() addCreamer() dispenseItem() CoffeeMachine totalReceipts collectMoney() makeChange() dispenseItem() VendingMaschine cansOfBeer cansOfCola chill() dispenseItem() SodaMachine bagsofChips numberOfCandyBars dispenseItem() CandyMachine
  • 26. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 26 Meta-Model for Inheritance Inheritance Specification Inheritance Implementation Inheritance Inheritance for ReuseTaxonomy Inheritance detected by generalization Inheritance detected by specialization Analysis activity Object Design
  • 27. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 27 For Reuse: Implementation Inheritance and Specification Inheritance • Implementation inheritance • Also called class inheritance • Goal: • Extend an applications’ functionality by reusing functionality from the super class • Inherit from an existing class with some or all operations already implemented • Specification Inheritance • Also called subtyping • Goal: • Inherit from a specification • The specification is an abstract class with all operations specified, but not yet implemented.
  • 28. Problem with implementation inheritance: • The inherited operations might exhibit unwanted behavior. • Example: What happens if the Stack user calls Remove() instead of Pop()? Example: • I have a List class, I need a Stack class • How about subclassing the Stack class from the List class and implementing Push(), Pop(), Top() with Add() and Remove()? Add() Remove() List Push() Pop() Stack Top() “Already implemented” Example for Implementation Inheritance • A very similar class is already implemented that does almost the same as the desired class implementation
  • 29. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 29 Delegation instead of Implementation Inheritance • Inheritance: Extending a Base class by a new operation or overriding an operation. • Delegation: Catching an operation and sending it to another object. • Which of the following models is better? +Add() +Remove() List Stack +Push() +Pop() +Top() +Push() +Pop() +Top() Stack Add() Remove() List
  • 30. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 30 delegates toClient Receiver Delegate calls Delegation • Delegation is a way of making composition as powerful for reuse as inheritance • In delegation two objects are involved in handling a request from a Client •The Receiver object delegates operations to the Delegate object •The Receiver object makes sure, that the Client does not misuse the Delegate object.
  • 31. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 31 Adapter Pattern • Adapter Pattern: Connects incompatible components. • It converts the interface of one component into another interface expected by the other (calling) component • Used to provide a new interface to existing legacy components (Interface engineering, reengineering) • Also known as a wrapper.
  • 32. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 32 Adapter Pattern ClientInterface Request() LegacyClass ExistingRequest() adaptee Adapter Request() Client Old System (“Legacy System”) New System
  • 33. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 33 Adapter for the Set problem Set add(element) adaptee MySet add(element) Client Hashtable put(key, element)
  • 34. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 34 Contraction • Contraction: Implementations of methods in the super class are overwritten with empty bodies in the subclass to make the super class operations “invisible“ • Contraction is a special type of inheritance • It should be avoided at all costs, but is used often.
  • 35. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 35 Revised Metamodel for Inheritance Inheritance Specification Inheritance Implementation Inheritance Inheritance for ReuseTaxonomy Inheritance detected by generalization Inheritance detected by specialization Analysis activity Object Design Strict Inheritance Contraction
  • 36. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 36 Documenting Object Design: ODD Conventions • Each subsystem in a system provides a service • Describes the set of operations provided by the subsystem • Specification of the service operations • Signature: Name of operation, fully typed parameter list and return type • Abstract: Describes the operation • Pre: Precondition for calling the operation • Post: Postcondition describing important state after the execution of the operation • Use JavaDoc and Contracts for the specification of service operations
  • 37. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 37 Package it all up • Pack up design into discrete units that can be edited, compiled, linked, reused • Construct physical modules • Ideally use one package for each subsystem • System decomposition might not be good for implementation. • Two design principles for packaging • Minimize coupling: • Classes in client-supplier relationships are usually loosely coupled • Avoid large number of parameters in methods to avoid strong coupling (should be less than 4-5) • Avoid global data • Maximize cohesion: Put classes connected by associations into one package.
  • 38. Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 38 Packaging Heuristics • Each subsystem service is made available by one or more interface objects within the package • Start with one interface object for each subsystem service • Try to limit the number of interface operations (7+-2) • If an interface object has too many operations, reconsider the number of interface objects • If you have too many interface objects, reconsider the number of subsystems • Interface objects vs Java interface: • Interface object: Used during requirements analysis, system design, object design. Denotes a service or API • Java interface: Used during implementation in Java (May or may not implement an interface object).

Notas do Editor

  1. O bject design is the process of adding details to the requirements analysis and making implementation decisions The object designer must choose among different ways to implement the analysis model with the goal to minimize execution time, memory and other measures of cost. Requirements Analysis: Use cases, functional and dynamic model deliver operations for object model Object Design: Iterates on the models, in particular the object model and refine the models Object Design serves as the basis of implementation
  2. Object-Oriented methodologies use these terms: The System Design activity involves the decomposition of the system into subystems
  3. Off-the-shelf components are also sometimes called COTS (commercial off-the-shelf components)
  4. A Detailed View of Object Design Activities
  5. New objects are often needed during object design: Let’s take as an example: The EraseArea() operation in a drawing program. Conceptually it is very simple, the Implementation Is much more complicated
  6. Problem formulation for customization Develop this new functionality as a set of operations of a new class or adapt an existing program to a new environment or a new customer. So the goal is to produce custom objects to close the object design gap.
  7. Let us think about how we model, When we observation Modeling of the Real World, we notice that we identify existing objects. Modeling of the real world leads to a system that reflects today’s realities but not necessarily tomorrow’s, or the visionary Scenario that drives our analysis. Transition to next slide: “Inheritance is found either by specialization or generalization”
  8. The distinction is subtle and depends on who is discovered first, the super class or the sub class
  9. After the generalization there is often an opportunity for Restructuring: Why don‘t we move the methods totalReceipts, collectMoney(), makeChange(), dispenseBeverage() into the super class?
  10. Now we have the method dispenseItem in the superclass! It should be an abstract method, implemented by each of the subclasses
  11. Inheritance is used during analysis as well as during object design! This is often confusing for modeling novices
  12. Inheritance is a generalization technique, in which the behavior of a superclass is shared by all its subclasses. Sometimes it is misused as an implementation technique. Question: Can you give me an example for unwanted behavior?
  13. The adapter pattern lets classes work together that couldn’t otherwise because of incompatible interfaces Object adapters are much more frequent. We will only cover object adapters (and call them therefore simply adapters)
  14. Delegation is used to bind an Adapter and an Adaptee (Legacy Class) Interface inheritance is use to specify the interface of the Adapter class. Adaptee (usually called legacy system) pre-exist the Adapter. Client Interface may be realized as an interface in Java.
  15. This is the final metamodel for modeling inheritance. Today we have added strict inheritance and contractions as two additional ways to use implementation inheritance: We identified strict inheritance as a good citizen, and if used this way, then implementation inheritance is a good thing. And we have shown that contract is a bad idea, because it leads to unmaintainable systems and unpredictable behavior.
  16. Each subsystem in a system provides a service (see Chapters on System Design) Describes the set of operations provided by the subsystem Specifying a service operation as Signature: Name of operation, fully typed parameter list and return type Abstract: Describes the operation Pre: Precondition for calling the operation Post: Postcondition describing important state after the execution of the operation Use JavaDoc for the specification of service operations.