OBJECT-ORIENTED
SOFTWARE ENGINEERING
UNIT 06 : Object Oriented Implementation
© 2018, PRAMOD PARAJULI
Disclaimer
These slides are part of teaching materials for Object Oriented
Software Engineering (OOSE). These slides do not cover all
aspect of learning OOSE, nor are these be taken as primary
source of information. As the core textbooks and reference
books for learning the subject has already been specified and
provided to the students, students are encouraged to learn
from the original sources.
Contents in these slides are copyrighted to the instructor and
authors of original texts where applicable.
OOSE UNIT 06 - Object Oriented Implementation
Reference:
Bruegge B., and Dutoit A. H. 2010, Object-oriented Software
Engineering using UML, Patterns and Java, 3rd ed., Prentice Hall
(Chapter 10)
OOSE UNIT 06 - Object Oriented Implementation
MAPPING CONCEPTS
Model transformations
Refactorings
Forward engineering
Reverse engineering
OOSE UNIT 06 - Object Oriented Implementation
MODEL TRANSFORMATION
Applied to object model and results in another object
model.
OOSE UNIT 06 - Object Oriented Implementation
REFACTORING
To improve source code readability or modifiability
without changing its behavior.
OOSE UNIT 06 - Object Oriented Implementation
FORWARD ENGINEERING
OOSE UNIT 06 - Object Oriented Implementation
REVERSE ENGINEERING
Mapping source code elements back to a set of
model elements.
CASE tools help build an approximate model.
Approximate – because forward engineering may lose
information e.g. associations are turned into collections
of references.
OOSE UNIT 06 - Object Oriented Implementation
TRANSFORMATION PRINCIPLES
Each transformation must address a single criteria.
Each transformation must be local.
Each transformation must be applied in isolation to
other changes.
Each transformation must be followed by a
validation step.
OOSE UNIT 06 - Object Oriented Implementation
TRANSFORMATIONS
Transform models
Optimising the object design models i.e. class models
Mapping associations to collections
Mapping operations contracts to exceptions
Mapping the class model to a persistent storage schema
OOSE UNIT 06 - Object Oriented Implementation
OPTIMISING THE OBJECT DESIGN MODEL
Optimising access paths
Repeated association traversals – frequent operations
between two objects through other objects must be simplified
by creating an association.
“Many” associations – decrease search time by reducing the
“many” to “one”
Misplaced attributes – reduce excessive modeling, calling vs.
hosting classes
OOSE UNIT 06 - Object Oriented Implementation
OPTIMISING THE OBJECT DESIGN MODEL
Collapsing objects
OOSE UNIT 06 - Object Oriented Implementation
OPTIMISING THE OBJECT DESIGN MODEL
Delaying
expensive
computations
OOSE UNIT 06 - Object Oriented Implementation
OPTIMISING THE OBJECT DESIGN MODEL
Caching the result of expensive computations
If some values are repeatedly access after
computation, its better to keep them in cache.
OOSE UNIT 06 - Object Oriented Implementation
MAPPING ASSOCIATIONS TO COLLECTIONS
OOSE UNIT 06 - Object Oriented Implementation
MAPPING ASSOCIATIONS TO COLLECTIONS
OOSE UNIT 06 - Object Oriented Implementation
MAPPING ASSOCIATIONS TO COLLECTIONS
OOSE UNIT 06 - Object Oriented Implementation
MAPPING ASSOCIATIONS TO COLLECTIONS
OOSE UNIT 06 - Object Oriented Implementation
QUALIFIED ASSOCIATIONS
OOSE UNIT 06 - Object Oriented Implementation
ASSOCIATION CLASSES
OOSE UNIT 06 - Object Oriented Implementation
MAPPING CONTRACTS TO EXCEPTIONS
Contracts help in;
Checking preconditions
Checking postconditions
Checking invariants
Dealing with inheritance
OOSE UNIT 06 - Object Oriented Implementation
MAPPING CONTRACTS TO EXCEPTIONS
Example
OOSE UNIT 06 - Object Oriented Implementation
OOSE UNIT 06 - Object Oriented Implementation
OOSE UNIT 06 - Object Oriented Implementation
MAPPING CONTRACTS TO EXCEPTIONS
OOSE UNIT 06 - Object Oriented Implementation
MAPPING OBJECT MODELS TO PERSISTENT STORAGE SCHEMA
Mapping classes and attributes
OOSE UNIT 06 - Object Oriented Implementation
MAPPING OBJECT MODELS TO PERSISTENT STORAGE SCHEMA
Mapping associations
OOSE UNIT 06 - Object Oriented Implementation
MAPPING OBJECT MODELS TO PERSISTENT STORAGE SCHEMA
Mapping associations
OOSE UNIT 06 - Object Oriented Implementation
MAPPING OBJECT MODELS TO PERSISTENT STORAGE SCHEMA
Mapping inheritance
relationships
(vertical)
OOSE UNIT 06 - Object Oriented Implementation
MAPPING OBJECT MODELS TO PERSISTENT STORAGE SCHEMA
Mapping inheritance
relationships
(horizontal)
OOSE UNIT 06 - Object Oriented Implementation
MANAGING IMPLEMENTATION
Documenting transformations Assigning responsibilities
For given transformation, use The core architect
same tool
The architecture liaison
Keep the contracts in the source
code, not in the object design
The developer
model
Use the same names for the
same objects
Make transformations explicit
OOSE UNIT 06 - Object Oriented Implementation
❃ Read ‘10.6 ARENA Case Study’ from
Bruegge B., and Dutoit A. H. 2010, Object-oriented Software Engineering using
UML, Patterns and Java, 3rd ed., Prentice Hall (Chapter 10)
OOSE UNIT 06 - Object Oriented Implementation
End of Unit 06 : Object-oriented Implementation
OOSE UNIT 06 - Object Oriented Implementation