Escolar Documentos
Profissional Documentos
Cultura Documentos
Design
The Role of Classes and
Objects in Design
• Identify the classes and objects that form the
vocabulary of the problem domain (key
abstractions)
• Invent the structures whereby sets of objects
work together to provide the behaviors that
satisfy the requirements of the problem
(mechanisms)
• This view represents the logical framework of
the system
Object Oriented Analysis
The intent of OOA is to define all classes, their
relationships, and their behavior. A number of
tasks must occur:
– Static Model (Object Model)
a) Identify classes
b) Specify class hierarchy
c) Identify object-to-object relationships
d) Model the object behavior
– Dynamic Model (Scenario Diagrams)
The UML Notation for Object Modeling
UML Object Model Notation
super class
Association
class name
attribute name
Class1 Class
Operation name
Attribute1 Attribute:
0..*
Operation1a Operation:
Operation1b subclass name
Multipicity of
association
Inheritance Aggregarion
OOA and OOD – Abbot’s Textual Analysis
P a rt o f sp e e ch M o d e l co m p o n e n t E x a m p le
p ro p e r n o u n in s t a n c e M ehdi H assan
im p r o p e r n o u n c la s s / t y p e / r o le s tu d e n t, te a c h e r
d o in g v e r b o p e r a t io n buy
b e in g v e r b c la s s ific a t io n is a h o r s e , is a b o o k
h a v in g v e r b c o m p o s it io n fa n h a s w in g s
a d je c tiv e a t t r ib u t e v a lu e o r c la s s t h is b a ll is g r e e n
a d je c tiv e p h r a s e a s s o c ia t io n t h e c u s t o m e r w it h c h ild r e n
o p e r a t io n t h e c u s t o m e r w h o b o u g h t t h e k it e
Derivation of the Object
Model
Derived from Peter Coad
Payment Price
Payment
Authorized
Payment
Stote Sale
Payment Sales
Object Model Diagram for
the Point of Sales System
Promotional Price Price Item UPCs
Authorized
Return Line Item Cheque Charge
Payment
Object Oriented Design
Transformation of the analysis model into
design model.
Classes Objects
methods algorithms
relationships messaging
behavior control
Translating the analysis model into a design model during object design
Object Oriented Programming
• OOP is simply implementing the OOD.
• Without OOD, OOP does not mean a lot.
Implementation of OOD in C++
• Classes - C++ Classes
• Messages - public methods
• Attributes - private variables/data structures
• Relationships
– Hierarchy
– Association
– Aggregation
Implementing Relationships in C++
• Hierarchy - inheritance
– Polymorphism - virtual methods (public or protected)
• Association
– private variables of type pointer to the associated class.
– Concept of an object factory
• Aggregation
– private variable (pointer or direct) of the type of the
aggregated class.
• Multiplicity of the relationship - standard
containers (usually a list or a map)
Bibliography
•Sommerville, Ian, Software Engineering, 5th Ed., Addison-Wesley, New York, 1995.
•Pressman, Roger S., Software Engineering – A Practitioner’s Approach, 4th Ed.,
McGraw-Hill, 1997.
•Booch, Grady, Object Oriented Analysis and Design, 2nd Ed., Benjamin/Cummings,
Redwood City, CA, 1994.
•Rumbaugh, J., Blaha, M., Premerlani, W., Eddy, F., and Lorensen, W., Object
Oriented Modeling and Design, Prentice Hall, Englewood Cliffs, NJ, 1991.
•Booch, G., and Rumbaugh, J., Unified Method for Object-Oriented Development,
Rational Software Corp., 1996.
•Coad, P., North, D., and Mayfield, M., Object Models - Strategies, Patterns, and
Applications, Yourdon Press, Englewood Cliffs, NJ, 1995
•Gamma, E. et al., Design Patterns, Addison-Wesley, 1995.
•Jacobson, I., Object Oriented Software Engineering, Addison-Wesley, 1992.