Mais conteúdo relacionado
2 uml
- 2. Introduction
•A model is an abstract representation
of a system, constructed to
understand the system prior to
building or modifying it.
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
building or modifying it.
•Most of the modeling techniques
involve graphical languages.
- 3. Why Modeling?
• Models make it easier to express complex
ideas. For example, an architect
builds a model to communicate ideas
more easily to clients.
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
• Models reduce complexity by separating
those aspects that are unimportant from
those that are important.
- 4. Advantages of Modeling (Con’t)
•Models enhance learning.
•The cost of the modeling analysis is
much lower than the cost of similar
experimentation conducted with a
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
experimentation conducted with a
real system.
•Manipulation of the model
(changing variables) is much easier
than manipulating a real system.
- 5. Modeling Key Ideas
•A model is rarely correct on
the first try.
•Always seek the advice and
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
•Always seek the advice and
criticism of others.
• Avoid excess model revisions, as they
can distort the essence of your model.
Let simplicity and elegance guide you
through the process.
- 6. The Unified Modeling Language
(UML)
• The unified modeling language (UML) is a
language for specifying, constructing,
visualizing, and documenting the software
system and its components.
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
A complete language for capturing
knowledge (semantics) about a
subject (system) and
communicating the knowledge
(syntax)
- 7. Primary goals in the design of the UML
• Provide users a ready-to-use, expressive visual
modeling language to develop and exchange
meaningful models.
• Provide extensibility and specialization
mechanisms to extend the core concepts.mechanisms to extend the core concepts.
• Be independent of particular programming
languages and development processes.
• Provide a formal basis for understanding the
modeling language.
• Encourage the growth of the OO tools market.
• Support higher-level development concepts
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
- 9. History of the UMLHistory of the UML
Nov ‘97 UML approved by the OMG
- 11. Static Views are modeled using
Use Case Diagrams
Class Diagrams
Object Diagrams
Component Diagrams
Deployment Diagrams
What can you model with UML?
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
Deployment Diagrams
Dynamic Views are modeled using
Sequence Diagrams
Collaboration Diagrams
Activity Diagrams
State-chart Diagrams
- 12. Static Model
•A static model can be viewed as a
"snapshot" of a system's
parameters at rest or at a specific
point in time.
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
point in time.
•The classes’ structure
and their relationships
to each other frozen
in time are examples of
static models.
- 13. Dynamic Model
•Is a collection of procedures or
behaviors that, taken together,
reflect the behavior of a system
over time.
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
over time.
•For example, an order interacts
with inventory to determine
product availability.
- 15. Building Blocks of UML
To understand the UML, you need to form a
conceptual model of the language, and this
requires learning three basic building blocks:
1. Elements: Main “citizens” of the model
2. Relationships: tie elements together
3. Diagrams: mechanisms to group
interesting collections of elements and
relationships
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
- 17. Structural Elements
1.1. ClassClass::
It is a description of a set of objects
that share the same attributes,
Static part of the model to represent conceptual or physical
elements
“nouns” of the model
that share the same attributes,
operations, relationships, and
semantics.
implements one or more interfaces.
Graphically, a class is rendered as a
rectangle, usually including its name,
attributes, and operations
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
- 18. Structural Elements
22.. InterfaceInterface::
• is a collection of operations that
specify a service of a class or
component.
• An interface might represent the
complete behavior of a class or
component or only a part of that
behavior
• An interface rarely stands alone.
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
Agency
- 19. Structural Elements
33.. ColloborationColloboration::
• Defines an interaction between
elements
• Several elements cooperating to
deliver a behavior rather than
individual behavior
Capture
online
individual behavior
• Includes structural and behavioral
dimensions
• Represents implementations of
patterns that make up a system
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
- 20. Structural Elements
44.. UseUse CasesCases::
• Description of a sequence of
actions that a system performs to
deliver an observable result to a
particular actor
• Used to structure the behavioral• Used to structure the behavioral
elements in a model
• Realized by collaboration
• Graphically rendered as an
ellipse drawn with a solid line
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
- 21. Structural Elements
55.. ActiveActive ClassesClasses::
• A class whose objects own one or
more processes or threads and
therefore can initiate an action
• A class whose objects have
concurrent behavior with otherconcurrent behavior with other
objects
• Graphically, an active class is
rendered just like a class drawn
with a thick line
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
- 22. Structural Elements
6.6. ComponentComponent
• is a physical and replaceable part
of a system that conforms to and
provides the realization of a set of
interfaces.interfaces.
• Graphically, a component is
rendered as a rectangle with tabs
• it also can be used to represent
applications, files, libraries,pages
and tables.
•
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
- 23. Structural Elements
77.. NodeNode ClassClass::
• is a physical element that exists at run
time
• represents a computational resource,
generally having at least some memory
and, often, processing capability.and, often, processing capability.
• a set of components may reside in a node
• components may also migrate from one
node to another
• Graphically, a node is rendered as a cube,
usually including only its name
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
- 24. Behavioral Elements
11.. InteractionInteraction::
• a set of messages exchanged among a set of objects
within a particular context to accomplish a specific
These are the dynamic parts of UML models.
Represent behavior over time and space
“verbs” of the model
Save application()
within a particular context to accomplish a specific
purpose
• specifies the behavior of a set of objects
• involves a number of other elements:
– messages, action sequences (behavior invoked by
a message) and links (connection between objects)
• graphically rendered as an arrow
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
- 25. Behavioral Elements
22.. StateState MachineMachine::
• specifies a sequence of states an object or an
interaction goes through during its lifetime and its
response to external events
• may specify the behavior of an individual class or a
collaboration of classescollaboration of classes
• includes a number of elements including states,
transition, events and activities
• presented as a rounded rectangle with a name and sub-
• states
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
- 26. Grouping Element
1.1. PackagePackage::
• mechanism for organizing elements
into groups.
Are the organizational parts of UML models. These are the boxes
into which a model can be decomposed .There is one primary
kind of grouping thing, namely, packages.
into groups.
• All elements can be placed in a package.
• Graphically, a package is rendered as a
tabbed folder, usually including only its
name and, sometimes, its contents
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
- 27. Annotational Element
1.1. NoteNote::
• comments added to models for better
explanation or illumination on specific elements
are the explanatory parts of UML models. These are the
comments you may apply to describe about any element in a
model.
explanation or illumination on specific elements
• explanatory aspect of UML models
• notes are used primarily for annotation e.g. for
rendering constraints and comments attached to
elements or collections of elements
• presented as a rectangle with a dog-eared corner
• may include both textual and graphical comments
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
- 28. Relationships in the UML
1.1. DependencyDependency::
There are four kinds of relationships in the UML:
1. Dependency
2. Association
3. Generalization
4. Realization
1.1. DependencyDependency::
• A semantic relationship between two
elements in which a change to one
element (independent element) may
affect the meaning of the other
(dependent element)
• Given as a directed dashed line possibly
with a label
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
- 29. Relationships in the UML
22.. AssociationAssociation::
• a structural relationship describing a set of links
• links are connections between objects
• aggregation is a special type of association depicting
whole-part relationshipwhole-part relationship
• association is presented as a solid line, possibly
directed, labeled and with adornments (multiplicity
and role)
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
- 30. Relationships in the UML
33.. GeneralizationGeneralization
• a relationship in which objects of a
specialized element (child) are
substitutable for objects of a
generalized element (parent)
• child elements share the structure• child elements share the structure
and behavior of the parent
• rendered graphically as a solid line
with hollow arrow head pointing to
the parent
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
- 31. Relationships in the UML
44.. RealizationRealization::
• a semantic relationship between
elements, wherein one element specifies
a contract and another guarantees to
carry out this contract
• relevant in two basic scenarios:• relevant in two basic scenarios:
– interfaces versus realizing classes or
components
– uses cases versus realizing collaborations
• graphically depicted as a dashed arrow
with hollow head a cross between
dependency and generalization
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
- 32. Diagrams in UML
• a graph presentation of a set of elements and
relationships where:
– nodes are elements
– edges are relationships
• UML includes nine such diagrams
1. Class Diagram
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
- 33. Diagrams in UML
1. Class Diagram:
o Static structure of a
system
o Show a set of classes,
interfaces, collaboration,
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
interfaces, collaboration,
and their relationships
o address static design
view of a system
- 34. Diagrams in UML
2. Object Diagram:
Static structure of a system at a particular time
Show a set of objects and their relationships
static snapshots of element instances found in class
diagrams
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
- 35. Diagrams in UML
3. Use Case Diagram:
Functionality of a system
Show a set of actors and use cases, and their relationships
addresses static use case view of the system
important for organizing and modeling the external
behavior of the system
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
behavior of the system
- 36. Diagrams in UML
4. Sequence Diagram:
Interaction among elements of a system in a
time sequence
show interactions consisting of a set of
objects and the messages sent and received by
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
objects and the messages sent and received by
those objects
address the dynamic behavior of a system
with special emphasis on the chronological
ordering of messages
- 38. Diagrams in UML
5.Collaboration Diagram:
Interaction among elements and their relations
organized in time and space
Show the structural organization of objects
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
Show the structural organization of objects
that send and receive messages
Sequence and collaboration diagram are
isomorphic i.e. one can be transformed into
another
- 40. Diagrams in UML
6. State Chart Diagram:
The status condition and responses of the elements of
a system
Show a state machine consisting of states, transitions,
events, and activities
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
events, and activities
address the dynamic view of a system
important in modeling the behavior of an interface,
class or collaboration
emphasize on event-driven ordering
- 42. Diagrams in UML
7. Activity Diagram:
The activities of the system
a diagram showing control/data flows from one
activity to another
addresses the dynamic view of a system, useful for
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
addresses the dynamic view of a system, useful for
modeling its functions
emphasizes the flow of control among objects
- 44. Diagrams in UML
8.Component Diagram:
The organization of the elements realizing the system
Show the organization and dependencies amongst a
set of components
address static implementation view of a system
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill
address static implementation view of a system
a component typically maps to one or more classes,
interfaces or collaborations
- 46. Diagrams in UML
9.Deployment Diagram:
Configuration of environment elements and the
mapping of elements realizing the system into them
Object-Oriented Systems Development Bahrami © Irwin/ McGraw-Hill