L6 Object Modeling Chapter5
L6 Object Modeling Chapter5
Object Modeling
Chapter 5, Analysis:
Software Lifecycle Activities
Object
Requirements System Implemen-
Analysis (Detailed) Testing
Elicitation Design tation
Design
Implemented
Expressed in By
Structured By Realized By
Terms Of Verified
By
class...
class...
class... ?
class.... ?
Use Case Application Solution
Domain Subsystems Source Test
Model Domain
Objects Code Case Model
Objects
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 2
An Optical Illusion
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 3
Outline
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 4
Analysis Model
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 5
Activities during Object Modeling
Main goal: Find the important abstractions
• Steps during object modeling
1. Class identification
2. Find the attributes
3. Find the operations
4. Find the associations between classes
• What happens if we find the wrong abstractions?
• We iterate and revise the model.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 6
Class Identification
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 7
Class Identification
• Approaches
• Application domain approach
• Ask application domain experts to identify relevant
abstractions
• Syntactic approach
• Start with use cases
• Analyze the text to identify the objects
• Extract participating objects from flow of events
• Design patterns approach
• Identify relevant abstractions that can be reused
(apply design knowledge)
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 8
There are different types of Objects
• Entity Objects
• Represent the persistent information tracked by the
system (Application domain objects, also called
“Business objects”)
• Boundary Objects
• Represent the interaction between the user and the
system
• Control Objects
• Represent the control tasks performed by the system.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 9
Example: 2BWatch Modeling
Year Button
ChangeDate
Month
LCDDisplay
Day
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 10
Naming Object Types in UML
To distinguish different object types
in a model we use the
UML Stereotype mechanism
<<Entity>> <<Boundary>>
Year <<Control>> Button
ChangeDate
<<Entitity>>
Month <<Boundary>>
<<Entity>> LCDDisplay
Day
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 12
Graphics for Stereotypes
• One can also use graphical symbols to identify a
stereotype
• When the stereotype is applied to a UML model element, the
graphic replaces the default graphic for the diagram element.
• Example: When modeling a network, we can define graphical
symbols to represent classes of type Switch, Server, Router and
Printer. Graphics for
Class of type
Printer Graphics for
Class of type
Router
Graphics for
Class of type Graphics for
Switch Server Class
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 13
Object Types allow us to deal with Change
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 14
Generalization and Specialization
Emergency
TrafficAccident Fire
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 15
Generalization and Specialization
Incident
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 16
Finding Participating Objects in Use Cases
suitable
An assistant helps him. The suitability
*Toy of the game depends on the age of the
Toy
price
buy() child. His daughter is only 3 years old.
buy()
like() The assistant recommends another
toy, namely a boardgame
type of toy boardgame. The
customer buy the game and leaves
VideoGame BoardGame
the store
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 18
Mapping grammatical constructs to model
components (Abbot’s Technique)
Grammatical UML model
Example
construct component
Toy Improper noun class
“Monopoly” Proper noun object
Buy, recommend Doing verb operation
Is a being verb inheritance
has an having verb aggregation
must be modal verb constraint
dangerous adjective attribute
enter transitive verb operation
depends on intransitive verb Constraint, class,
association
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 19
Ways to find Objects
• Syntactical investigation with Abbot‘s technique:
• Flow of events in use cases
• Problem statement
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 20
Order of Activities for Object Identification
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 21
Steps in Generating Class Diagrams
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 22
Who uses Class Diagrams?
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 23
Who does not use Class Diagrams?
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 24
Developers have different Views on Class
Diagrams
• According to the development activity, a
developer plays different roles:
• Analyst
• System Designer
• Object Designer
• Implementor
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 25
The View of the Analyst
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 26
The View of the Designer
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 27
The View of the Implementor
• Class implementor
• Must realize the interface of a class in a programming
language
• Interested in appropriate data structures (for the
attributes) and algorithms (for the operations)
• Class extender
• Interested in how to extend a class to solve a new
problem or to adapt to a change in the application
domain
• Class user
• The class user is interested in the signatures of the
class operations and conditions, under which they can
be invoked
• The class user is not interested in the implementation
of the class.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 28
Why do we distinguish different Users of
Class Diagrams?
• The key for creating high quality software
systems is the exact distinction between
1. Application and solution domain classes on one side
• Preferred: No solution classes in the analysis model
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 29
Software Lifecycle Activities:
Analysis Model vs. Object Design model
Object
Requirements System Implemen-
Analysis (Detailed) Testing
Elicitation Design tation
Design
Implemented
Expressed in By
Structured By Realized By
Terms Of Verified
By
class...
class...
class... ?
class.... ?
Use Case Application Solution
Domain Subsystems Source Test
Model Domain
Objects Code Case Model
Objects
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 30
Analysis Model vs. Object Design model
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 31
Analysis Model vs. Object Design model
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 32
Analysis Model vs Object Design Model (2)
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 33
Summary
• System modeling
• Functional modeling + object modeling + dynamic
modeling
• Functional modeling
• From scenarios to use cases to objects
• Object modeling is the central activity
• Class identification is a major activity of object modeling
• Easy syntactic rules to find classes and objects
• Abbot’s Technique
• Class diagrams are the “center of the universe”
for the object-oriented developer
• The end user focuses more on the functional model and
usability.
Bernd Bruegge & Allen H. Dutoit Object-Oriented Software Engineering: Using UML, Patterns, and Java 34