UML
UML
establishing:
a correspondence between the elements of the target
There are also parts and relationships in the target that are not captured in the
model, and parts and relationships in the model that do not correspond to
anything in the target. This highlights the fact that models are not perfect
(Note: Discussed this in detail in class with the help of railroad model
example)
Models in Design
copies rather than models. The fact that models are abstractions of their
the ability to use models with an understanding of what they can't do.
Modeling in Design
tool in all design disciplines. Models are useful in design in three ways:
Models in Design
1. Problem Understanding
Designers must understand design problems and constraints before they can
Floor plans, elevations, schematics, blueprints, and diagrams of all sorts are
3. Documentation
that implement part of the final result (prototypes) are sometimes used.
Software design problems and solutions are often complex, and many aspects
Static models
Software Design Model
Dynamic models
Dynamic
Static Model
Model
Models in Design
Static models
Dynamic model
execution.
Modeling with UML
(Need)
well suited for representing a given aspect of a system, and it must be well
in the industry.
The goal of UML is to provide a standard notation that can be used by all
precursor notations. For example, UML includes the use case diagrams
introduced by OOSE and uses many features of the OMT class diagrams.
UML also includes new concepts that were not present in other major
The functional model, represented in UML with use case diagrams, describes
The object model, represented in UML with class diagrams, describes the
between states. Activity diagrams describe behavior in terms control and data
UML
Class Diagrams
Interaction Diagrams
Activity Diagrams
Use Case Diagrams
Use Case Diagrams
Use cases are used during requirements elicitation and analysis to represent
the functionality of the system. Use cases focus on the behavior of the
An actor describes any entity that interacts with the system (e.g., a user,
actors and use cases results in the definition of the boundary of the system.
Use Case Diagrams
The actors are outside the boundary of the system, whereas the use cases
are inside the boundary of the system. Then we have relationships between
Association
Include
Extend
Generalization
Use Case Diagrams
Take the example of a use case diagram for a simple watch. The Watch
User actor may either consult the time on their watch (with the Read Time
use case) or set the time (with the Set Time use case). However, only the
Watch Repair Person actor can change the battery of the watch (with the
Actors are represented with stick figures, use cases with ovals, and
the boundary of the system with a box enclosing the use cases .
Straight lines show association.
Use Case Diagram for online Banking
Class Diagrams
Class Diagrams
The Unified Modeling Language (UML) can help you model systems in
various ways. One of the more popular types in UML is the class diagram.
diagrams are a type of structure diagram because they describe what must
classifier or an object.
Middle section: Contains the attributes of the class. Use this section to
describe the qualities of the class. This is only required when describing a
format, each operation takes up its own line. All classes have different
access levels depending on the access modifier (visibility). Here are the
Private (-)
Protected (#)
Package (~)
Class Diagrams
Relationships:
Inheritance/Generalization
Association
Aggregation
Composition
Multiplicity
Inheritance
In other words, the child class is a specific type of the parent class. To
show inheritance in a UML diagram, a solid line from the child class to the
Parent class or super class also represent the abstract class. Abstraction is
used to keep the code DRY (Don’t Repeat Yourself). The example of zoo
ssociation
Aggregation
Aggregation
Composition
the container class. Or that type of relationship where part can’t exist
diamond. Lets continue with the same zoo system example and consider
Composition
Multiplicity
For example in the visitor center example, we want to specify that our
visitor center will have just one lobby and at least one washroom we
• a Simple Watch has exactly two Push Buttons, one Display, two
Batteries, and one Time. Similarly, all Push Button, Display, Time, and
Battery objects are associated with exactly one Simple Watch object.
Interaction Diagrams
Interaction Diagrams
useful for identifying additional objects that participate in the use cases.
diagram, called a sequence diagram, for the Set Time use case of our
Interaction Diagrams
simple watch. The left-most column represents the Watch User actor who
initiates the use case. Labeled arrows represent stimuli that an actor or an
object sends to other objects. In this case, the Watch User presses button 1
twice and button 2 once to set her watch a minute ahead. The Set Time use
case terminates when the Watch User presses both buttons simultaneously.
Interaction Diagram for Simple Watch
State Machine
Diagrams
State Machine Diagrams
transition represents a future state the object can move to and the
there is a state machine diagram for the Watch. A small black circle
initiates that Blink Hours is the initial state. A circle surrounding a small
State Machine Diagrams
black circle indicates that Stop Blinking is a final state. The diagram
which it is decomposed and the flow of control and data between them.
broken into parts, and hence is atomic. Ultimately, all activities must be
edges are represented by solid arrows with unfilled arrow heads. The
way to start execution and a way to stop it. A special initial node,
begins. Execution stops when tokens can no longer flow through the
diagram, but the end of an activity can also be indicated explicitly (or
Two additional nodes provide more control over concurrent execution and
synchronization in activity diagrams. A fork node, represented by a thick
line, has one edge entering it and multiple edges leaving it. A token
available on the entering edge is reproduced and made available on all the
outgoing edges. This effectively starts several concurrent threads of
execution. A join node, also represented by a thick line, has multiple edges
entering it, but only one edge leaving it. Tokens must be available on all
entering edges before a token is made available on the outgoing edge. A
join node synchronizes concurrent threads of execution.
Activity Diagrams
Activity Diagrams
for data flows into or out of the action node. Each pin must either have a
single edge entering it (an input pin) or leaving it (an output pin). The
name of the data or object type appears beside the pin, a description of
the state of the data or object can appear after the name in square
brackets, just as with an object node. Pins are simply an alternative way
Part -1 of diagram
Food for Thought
Your Level of
Success is
Determined by
your Level of
Disciplin