What Is Visual Modelling?: Computer System Business Process
What Is Visual Modelling?: Computer System Business Process
"#$%&'&(#")(*+&',"
-'./(012
!"#$%&&'(%)'*+%",#$%"#-'%&'#./)$+
01"+2,)3+45#6+#-')7'8
Slide 1
Order
Item
Slide 2
What is UML?
! UML stands for Unified Modeling Language
! The UML combines the best from
• Data Modelling concepts (Entity Relationship Diagrams)
• Business Modelling (work flow)
• Object Modelling
• Component Modelling
! The UML is the standard language for visualizing,
specifying, constructing, and documenting the artefacts of
a software-intensive system (based on object concepts)
! It can be used with all processes, throughout the
development life cycle, and across different
implementation technologies
! An OMG (Object Management Group) standard
Slide 3
History of UML
!"#$%&'
-./&:;;23,$#;20&<+=&>556
!"#$%&'()*"''"+#&,+&-./0&123&456 !"#$(&(
!"7',&'()*"''"+#&,+&-./0&8$#&956
@.A&3$7,#27' !"#$(&'
8(#2&95?&
!"#$'&7
!/?@?36$"312,6$'&E "?+4,.,@1
A8"$BC$
04*+D3
01234$5312,6.
B2$*CD$'2E&
F2=2%+3*2#,
.+E2%"#G& @#"H"2E&
A$#G($G2 I7+;2''
ANALYSIS
DESIGN
DEVELOPMENT
TEST
MAINTENANCE
Slide 6
Rational Unified Process (RUP)
)*+,(-+&'("
1-+"/'&'("
!"#$%&'("
.("/&-0#&'("
1 2 3 …
Slide 8
Phases and Iterations
Slide 9
Slide 11
! … some motivations:
• Communication
in particular communication with Domain Experts
• Natural language is too imprecise
• Code is precise but too detailed
• UML allows to achieve a certain amount of precision without get lost in
details (to highlight important details)
• Learning OO
“Object languages allow advantages but don't provide them. To use
these advantages, you have to make the infamous paradigm shift”
Tom Hadfield
• The techniques define in UML were to some degree designed to
help people do good OO Slide 12
Putting the UML to Work
! The case study is a point-of-sale terminal* system.
POST is a Web-based system used to allow customers
to browse through products, record sales and handle
payments (used in online-shops)
! We have been requested to create the software to run a
POST
! We will use an iterative-incremental development
strategy
• Requirements
• Object-oriented analysis
• Object-oriented design
• Implementation *Source : Craig Larman, “Applying UML and Patterns”
Slide 13
ANALYSIS PHASE
Slide 14
Requirements
! Unambiguous description of needs or desires for a product.
• Goals
• System functions (functional requirements) - what system is
supposed to do (e.g. system should do credit payment
authorization)
• System attributes (non-functional requirements) -
characteristics or dimensions of the system (e.g. fault tolerance,
response time, …)
• Use cases (narrative descriptions, stories or cases of using a
system)
• Analysis of risks
• Requirements risks
• Technological risks
• Skills risks
• …
! The artefacts produced in this phase are not UML-specific
Slide 15
Use Case
! A use case is a pattern of behaviour the system
exhibits
• It is a relatively large end-to-end process description that
typically include many steps and transactions
! A flow of events document is created for each use
case
• Written from an actor point of view
• Specification of the interactions of an actor with the system
• None of the inner workings of the system is discussed, nor is
the user interface described in any detail
! Typical contents
• How the use case starts and ends
• Normal flow of events
• Alternate flow of events
• Exceptional flow of events Slide 18
Talking with the customer
! Azienda: mi spieghi come si usa il servizio?
! Cliente: Il cliente naviga nel catalogo e raccoglie gli
articoli in un carrello della spesa. Quando il cliente
desidera pagare, descrive la modalità di spedizione
e fornisce le informazioni relative alla carta di credito
per confermare l’acquisto.
! Azienda: l’acquisto va sempre a buon fine?
! Cliente: No, il sistema controlla se la carta di credito
è valida e conferma l’acquisto sia immediatamente
che con un successivo messaggio e-mail
Slide 19
Slide 20
Actors
! An actor is an entity external to the system who
participate in the story of the use case
• Actors don't need to be human
! An actor typically stimulate the system with input
events or receives something from it.
! Actors are represented by the role they play in the
use case.
Customer
Example
Use Case Diagrams
Slide 24
Include and Extend Use Cases
! <<include>> relationship is used to make the
structure of the use cases more efficient by
collapsing repeated operation in smaller use cases
that can be shared among many other use cases
! <<extend>> relationship is used when there are
many alternatives or options within a use case.
• Separation of the invariant part of the use case from
the variable parts
• The invariant part becomes the use case that is
extended
• The variable parts become the extending use cases
• A use case may have many extension points, and an
extending use case may extend one or more of these
extension points Slide 25
<<include>> Relationship -
Notation
! The “Buy Items” use case is bound to the “View
Price List” use case by an oriented dashed line.
The arrowhead points to the included use case
and has the stereotype <<include>>
• The description of the “View Price List” use case is
inserted in the appropriate location of the “Buy Items”
use case
View
Price List <<include>>
Buy Items
Source : Craig Larman, “Applying UML and Patterns”
Slide 26
<<extend>> Relationship - Notation
Checkout
<<extend>>
Slide 27
Terminology
! Scenario
• A specific sequence of actions that illustrates
behaviors (a sequence of steps describing an
interaction between a user and a system)
• A use case is a set of scenarios tied together by a
common user goal
! Business vs. system use case
• The general usage is that a system use case is an
interaction with the software, whereas a business use
case discusses how a business responds to a
customer or an event
• The focus is first on business use cases, and then to
the system use cases that satisfy them. At least one
set of system use cases is expected for each business
use case identified Slide 28
When to Use “Use Cases”
“I can't imagine a situation now in which I would not use use
cases. They are an essential tool in requirements capture and
in planning and controlling an iterative project. Capturing use
cases is one of the primary tasks of the elaboration phase”
Slide 30
Ranking Use Cases
! Development cycles are organized around use
case requirements; a development cycle is
assigned to implement one or more use cases, or
simplified versions of use cases.
! Ranking use cases
• High ranking need to be tackled in early development
cycles.
• Qualities affecting the ranking
• Significant impact on the architectural design
• Significant information
• Include risk, time-critical or complex function
• Involve significant research and/or new and risky technology
• Represent primary line-of-business processes
• …
Slide 31
Slide 32
Conceptual Model
! The most important artefact to create during
object-oriented analysis. It may show:
• Concepts (a concept has a symbol, intension and
extension)
• Associations between concepts
• Attributes of concepts
! Representation of real-word things, not of
software components
• It is better to over specify a conceptual model with a
lots of fine-grained concepts, than to under specify it
• Finding concepts
• The concept category list
• Identifying nouns and noun phrases in textual descriptions of
a problem domain Slide 33
Conceptual Model
! Central distinction between object-oriented
and structured analysis
• Division by concepts (objects) rather than
division by functions
! A conceptual model is not absolutely correct
or wrong, but more or less useful
• It is a tool of communication (with
Stakeholders).
! Developers tend to do use cases and
conceptual modeling at the same time
Slide 34
POST – Conceptual Model
Slide 35
DESIGN PHASE
Slide 36
The Architecture
3!45/'.+5.64+7('&(#(.+48(./#.($9.&(9:(;+9;$+(.4%(
.9()+:'"+<(-'./($'..$+(#,4++8+".=(>/+4+(#4+(.-9(
59889"(+$+8+".&?(9"+('&(./+(/',/+&.@$+A+$(
B4+#C)9-"(9:(#(&%&.+8('".9('.&(;#4.&D(./+(9./+4<(
)+5'&'9"&(./#.(#4+(/#4)(.9(5/#",+=(E.F&(#$&9(
'"54+#&'",$%(4+#$'G+)(./#.(./+4+('&"F.(H6&.(9"+(
-#%(.9(&.#.+(#(&%&.+8F&(#45/'.+5.64+D(4#./+4<(
./+4+(#4+(86$.';$+(#45/'.+5.64+&('"(#(&%&.+8<(#")(
./+(A'+-(9:(-/#.('&(#45/'.+5.64#$$%(&',"':'5#".('&(
9"+(./#.(5#"(5/#",+(9A+4(#(&%&.+8F&($':+.'8+=
Slide 37
Evolution of Layers in EA
! In the '90s client
client––server systems
• Two-layer systems: the client held the user interface and other
application code; the server was usually a relational database
• Generally a screen was built by dragging controls onto a design area and
then using property sheets to connect the controls to the database
! Problems came with domain logic:
logic business rules, validations,
calculations, …
• Usually written on the client, by embedding the logic directly into the UI
• As the domain logic got more complex, this code became very difficult to
work with
• Simple changes resulted in hunting down similar code in many screens
• Alternative: put the domain logic in the database as stored procedures
• Stored procedures gave limited structuring mechanisms
• SQL as a standard would allow changing the database vendor (few people
actually did this). Stored procedures removed that option. since they are all
proprietary,
Slide 40
Evolution of Layers in EA (II)
! The object oriented community had an answer to
the problem of domain logic:
• Move to a three
three--layer system
• A presentation layer for the UI, a domain layer for the domain
logic, and a data source layer
• Issues
% Many systems were simple
• Although the three-layer approach had many benefits, the tooling for
client–server was compelling if the problem was simple
% The client–server tools were difficult, or even
impossible, to use in a three-layer configuration
Slide 41
Slide 42
The Three Principal Layers
! Presentation logic - handles the interaction between the
user and the software
• Can be as simple as a command-line or text-based menu
system, or a rich-client graphics UI or an HTML-based browser
UI
• Responsibilities: to display information to the user and to
interpret commands from the user invoking the corresponding
actions
! Domain logic,
logic aka business logic
• Involves calculations based on inputs and stored data, validation
of any data, and choosing the right data source logic
! Data source logic - communicates with other systems
• e.g. transaction monitors, other applications, messaging systems
• Generally a database, responsible for storing persistent data
Slide 43
Slide 46
Typical Class Diagram
Source :
Fowler, Martin
UML Distilled
Addison Wesley
Slide 47
Class Diagram -
Notation and Semantics
! In UML, a class is drawn as a rectangle with three
compartments
Name
attribute:type
operation():type
… more on Associations
! Within the implementation perspective one can
deduce information about data structure
• Associations are most often implemented as instance
variables (attribute visibility) in one class that point or
refer to the other
! The navigability of an association can be
restricted by adding arrowheads
• When an arrowhead is present, the association can
only be navigated in the direction of the arrow. This
means that the class to which the arrow points does
not know about its associate
Order Customer
Slide 50
Aggregation and Composition
! Aggregation is a special form of association
• Is denoted with a white diamond on the aggregate class
• Implies a “whole/part” relationship
• The “whole/part” relationship is purely connotative
connotative; there is no
semantic difference from association
Studente Esame
Constraints
! The basic constructs of association, attribute,
and generalization can be used to specify
important constraints
• But … they cannot indicate every constraint
! The UML allows to use anything to describe
further constraints
• The only rule is to put them inside braces “{}”.
• One can use an informal English, emphasizing
readability
• The UML also provides a formal Object Constraint
Language (OCL)
Slide 52
Making a Class Diagram
! Identify all the classes participating in the software solution. Do this by
analysing the conceptual model
• It is not usually useful to show container/collection classes explicitly in
the class diagram
! Draw them in a class diagram
! Add methods names by analysing the interaction in the conceptual
model
• Do not add accessing methods
! Add type information to the attributes and methods
• Too many details may adversely effect the noise-to-value ratio
! Add the associations necessary to support the required attribute
visibility
! Add navigability arrows to the associations to indicate the direction of
the attribute visibility
! Add dependency relationship lines to indicate non-attribute visibility
Slide 53
Slide 54
POST – Class Diagram
Slide 55
Generalization
! The activity of identifying commonality
among concepts and defining supertype
(general concept) and subtype (specialized
concept) relationship
! Create a subtype of a supertype when either:
• The subtype has additional attributes of interest
• The subtype has additional associations of
interest
• The subtype concept is operated upon, handled
or behaves differently than the supertype or
other subtypes, in ways that are of interest
Slide 56
Generalization
! Create a supertype in a generalization
relationship to subtypes when:
• The potential subtypes represent variations on a
similar concept
• The subtypes will conform to the is-a rule
• All subtypes have the same attribute which can
be factored out and expressed in the supertype
• All subtypes have the same association which
can be factored out and related to the supertype
Slide 57
POST – Generalization
! Type hierarchy of various kind of payments
Slide 58
Interaction Diagram
Slide 59
Interaction Diagrams –
Behavioural Modelling
! One of the most important artefacts created in
object-oriented design
• Typically, an interaction diagram captures the behavior of a
single use case
• Illustrate the message interactions between instances. UML
defines two kinds:
• Collaboration diagram
% The layout indicates how objects are statically connected
% The sequence is indicated by numbering the messages
• Sequence diagram
% Emphasizes the time ordering of messages
% Two features distinguish it from collaboration diagram:
• There is the object lifeline
• There is the focus of control (period of time during which an object is
performing an action)
Slide 60
Interaction Diagrams –
Behavioural Modelling
! The skilful assignment of responsibilities that occurs
while creating interaction diagrams is very important
• The amount of time and effort spent on their generation and the
careful considerations of responsibility assignment, should
absorb a significant percentage of the design phase of a project
• Codified patterns and principles can be applied to improve the
quality of the design
! Interaction diagrams are good at showing collaborations
among the objects; they are not so good at precise
definition of the behavior.
• If one want to look at the behavior of a single object across
many use cases, one should use a state diagram
• If one want to look at behaviors across many use cases or many
threads, one should consider an activity diagram
Slide 61
Collaboration Diagram –
UML Notation
! Message syntax:
! Illustrating iteration
Slide 62
Collaboration Diagram –
UML Notation
Slide 63
Collaboration Diagram –
UML Notation
Slide 64
Collaboration Diagram –
UML Notation
Slide 65
Source :
Fowler, Martin
UML Distilled
Addison Wesley
Slide 66
Sequence Diagram
! Within a sequence diagram, an object is shown as a box at the top of
a dashed vertical line, called the object's lifeline
• The lifeline represents the object's life during the interaction
• Each message is represented by an arrow between the lifelines of two
objects
• The order in which these messages occur is shown top to bottom on the
page
• To show when an object is active one can include an activation box
• Control markers
• Condition, which indicates when a message is sent (for example,
[needsReorder]). The message is sent only if the condition is true
• Iteration marker, which shows that a message is sent many times to
multiple receiver objects. One can show the basis of the iteration within
brackets, such as *[for all order lines]
• Return indicates a return from a message, not a new message
Slide 67
Source :
Fowler, Martin
UML Distilled
Addison Wesley
Slide 68
Sequence Diagram
Slide 69
Sequence Diagram -
Concurrent Processes
Source :
Fowler, Martin
UML Distilled
Addison Wesley
Slide 70
Sequence Diagram -
Concurrent Processes (cont’d)
Source :
Fowler, Martin
UML Distilled
Addison Wesley
Slide 71
State Diagrams
Slide 72
State Diagrams
! A familiar technique to describe the behavior of a
system
! They describe all the possible states that a particular
object can get into and how the object's state
changes as a result of events that reach the object.
! In most OO techniques, state diagrams are drawn
for a single class to show the lifetime behavior of a
single object across several use cases
! When to use
• Use state diagrams only for those classes that exhibit
interesting behavior
• Many people find that UI and control objects have the
kind of behavior that is useful to depict with a state
diagram. Slide 73
Example
Source :
Fowler, Martin UML Distilled
Addison Wesley
Slide 76
Activity Diagrams
! These diagrams are particularly useful in
connection with workflow and in describing
behavior that has a lot of parallel processing
! The activity diagram describes the sequencing of
activities, with support for both conditional and
parallel behavior
• An activity diagram is a variant of a state diagram in
which most, if not all, the states are activity states
! The core symbol is the activity state, or simply
activity.
• An activity is a state of doing something: either a real-
world process, such as typing a letter, or the execution
of a software routine, such as a method on a class
Slide 77
Source :
Fowler, Martin UML Distilled
Addison Wesley
Slide 78
Activity Diagrams - Semantics
! Conditional behavior is delineated by branches and
merges.
• A branch has a single incoming transition and several guarded
outgoing transitions, mutually exclusive.
• The [else] guard indicates that the transition should be used if all the
other guards on the branch are false.
• A merge has multiple input transitions and a single output. A
merge marks the end of conditional behavior
! Parallel behavior is indicated by forks and joins.
• A fork has one incoming transition and several outgoing
transitions. When the incoming transition is triggered, all of the
outgoing transitions are taken in parallel.
• join is used to synchronize parallel behaviors. With a join, the
outgoing transition is taken only when all the states on the
incoming transitions have completed their activities. Slide 79
Activity Diagrams
Slide 80
Swimlanes
Slide 84
Package
! One of the oldest questions in software methods is:
“How do you break down a large system into
smaller systems?”
Packages
! Group elements that provide
common service (or family of
related services), with relatively
high coupling and collaboration
(dependency)
• At some level of abstraction the
package will be view as highly
cohesive – it has strongly related
responsibility
! A package is shown as a large
rectangle with a small rectangle
(a “tab”) attached to the left side
of the top
• The members of the package
may be shown within the large
rectangle
! A dependency between two
Source :
packages exists if any - A diagram representing relations among packages Fowler, Martin
UML Distilled
dependency exists between any Addison Wesley
Slide 87
Slide 89