Professional Documents
Culture Documents
Modeling and UML
Modeling and UML
Modeling and UML
Learning Objectives
• Define model and diagrams and explain importance of
them to system development.
• Introduce UML
Definitions
• A model is a simplified representation of something in
the real world, usually for the purpose of understanding
that reality, and having all the features of that reality
necessary for the current task or problem.
Like a map, a model represents something else.
• Thus modeling is a form of abstraction, that is, the
process of focusing only on features essential to the
problem at hand.
What Are Models For?
• Models are used for:
To capture and precisely state requirements and domain
knowledge so that all stakeholders may understand and
agree on them.
To think about the design of a system.
To capture design decisions in a mutable form separate from
the requirements.
To generate usable work products.
To organize, retrieve and edit info about large systems.
To explore multiple solutions economically.
To master complex systems.
Levels of Models
• Models take on different forms and appear at different
levels of abstraction.
A useful model has the right level of detail and represents only
what is important for the task in hand.
• The amount of detail in the model is adapted to one of the
following purposes:
Guides to the thought process.
Abstract specifications of the essential structure of a system.
Full specification of a final system.
Exemplars of typical or possible systems.
Complete or partial descriptions of systems.
Many Matching Models
• Each model emphasizes some aspect of the real-world
thing.
• Thus, many models are required to reveal all the
important details of that thing.
• Yet, these matching models must eventually fit together.
What is represented in one model must be consistent with
what is represented in another model.
House Blueprint
Diagrams
• Diagrams are abstract shapes that are used to
represent things or actions from the real world
• Diagrams follow rules or standards
• The standards make sure that different people will
interpret the diagram in the same way
An Example of a Diagram
• An activity diagram of the Author Reviewer Typesetter Printer
Revise Chapter
[book not
complete]
[book complete]
Typeset Book
Correct Proofs
Reset Book
Print Book
Diagrams versus Models
• A diagram illustrates some aspect of a system.
• A model provides a complete view of a system at a
particular stage and from a particular perspective.
• A model may consist of a single diagram, but most
consist of many related diagrams and supporting data
and documentation.
Models in Systems Development
• To understand the user’s world we need:
People sensitivity (interviewing and listening skills) for
gathering relevant and accurate information.
Modeling diagrams to document and communicate what
we’ve learned from the users.
o We are using UML as our modeling notation.
Modeling techniques to ensure these notations produce an
accurate picture of the user’s business.
o These are partly defined by:
the modeling notation itself, as well as
the software process/methodology.
Developing Models
• The models that we produce during the development of
a system change as the project progresses.
• They change by degree of:
Abstraction
o Model will become less abstract and more concrete.
Formality
o Degree of formality in which methods, attributes, and constraints
are defined will increase as project progress.
Level of detail
o More potential detail in every model as project progresses.
Development of Use Case Model through
successive iterations
Iteration 1
Staff Management
Change the
grade for a
staff member
Calculate staff
bonuses
Calculate staff
Iteration 2
Staff Management
Calculate staff
OK Quit
bonuses
OK Quit
Prototypes.
Find campaign
Campaign Management
OK Quit
OK Quit
Prototypes.
Earlier Models and Diagrams
• A variety of modeling notations have developed over
the years. These include:
Process models (data flow diagrams)
Data models (ERDs)
Process Models: Data Flow Diagrams
• Focus not just on Student Details Registration
Validated Student Student
generalization association
dependency realization
Diagrams in UML
• two-dimensional symbols
Produce
• paths First Draft
• Strings
Revise Draft
[not satisfied]
[satisfied]
collaboration diagram
statechart diagram
activity diagram
UML Parts
• A system is modeled as a collection of discrete objects
that interact to perform work that ultimately benefits an
outside user.
• UML has:
static and,
dynamic parts.
Static and Dynamic Information
• In particular UML captures information about the
static structure and the dynamic behavior of a
system.
The static structure defines the kinds of objects
important to a system and to its implementation, as
well as the relationships among the objects.
The dynamic behavior defines the history of objects
over time and the communications among objects to
accomplish goals.
Organization
• The UML also contains organization constructs for
arranging models into packages that permit software
teams to:
partition large systems into workable pieces.
understand and control dependencies among the packages,
and
manage the versioning of model units in a complex
development environment.
• The UML contains constructs for representing
implementation decisions and for organizing run-time
elements into components.
Organization
• The UML also contains organization constructs for
arranging models into packages that permit software
teams to:
partition large systems into workable pieces.
understand and control dependencies among the packages,
and
manage the versioning of model units in a complex
development environment.
• The UML contains constructs for representing
implementation decisions and for organizing run-time
elements into components.
Static Structure
• Any precise model must first define the universe of
discourse.
That is, the key concepts from the application, their
internal properties, and their relationships to each other.
• This set of constructs is the static view of the system.
• The static view is notated by class diagrams (also
called class static structure diagrams).
That is, the application concepts are modeled as classes,
each of which describes a set of discrete objects that
hold information and communicate to implement behavior.
Class static structure diagrams
BankAccount Customer
-customerName
-accountNum
-balance
+getCustomerName()
+getAccountNum()
+getBalance()
+setBalance()
Loan CheckingAccount
-interestRate -serviceCharge
+makePayment() +deposit()
+addInterest() +withdrawal()
Dynamic Behavior
• There are two ways to model behavior:
One is the communication patterns of a set of connected
objects as they interact to implement behavior.
o This is modeled using use case diagrams, sequence
diagrams, collaboration diagrams, and activity diagrams.
The other is the evolution of an object’s state over time
as it interacts with the rest of the world.
o State change refers to possible changes in object’s attributes
and associations with other objects.
o This is modeled as a statechart.
Use Cases
• When we analyze a system we try to identify the main
functionality that the system will have and the main
ways it will be used.
• Each of these ways the system is going to be used is
called a use case.
A use case is a sequence of actions a system performs
that yields an observable result of value to a particular
actor.
o An actor is either a person (user) interacting with the system
or, in some cases, another system interacting with the
system.
Using Use Cases
• A use case captures the main functionality of the
system from a user or actor’s perspective.
• It also serves as a vehicle to divide the system into
parts that can be implemented somewhat
separately.
For any given system, we will usually develop and
implement the most important use cases first.
Establishing which use cases are important often
follows from looking at the main events in the problem
domain.
Use Case Diagram
• We can model use cases in a Video Store System
use case diagram.
Stick figures represent actors. Rent Videos
• vertical columns
• labelled with the Record Completion
of a campaign
person, organisation
or department Issue invoice
responsible for the
activities in that
column Pay invoice
Record client
payment
Sequence Diagrams
• The class diagram is limited in that it does not
represent time-dependent behaviors.
• Sequence diagrams present object interactions
arranged in time sequence.
It shows the actors or objects participating in an
interaction and the events they generate arranged in a
time sequence.
Often, a sequence diagram shows the events that result
from a particular instance of a use case but a sequence
diagram can also exist in a more generic form.
Sequence Diagrams
RecordID()
CheckStatus()
status()
RecordCallNumber()
CalcDueDate()
RecordLoan()
dueDate()
Collaboration Diagram
• A collaboration diagram shows interactions organized
around the objects and their messages to each other.
Collaboration diagrams and sequence diagrams are
used interchangeably.
• Unlike a sequence diagram, a collaboration diagram
shows relationships among object roles and it does
not express time as a separate dimension.
2: Message2()
Message1() 3: Message3()
ClassAInstance ClassBInstance
Statechart Diagram
• The statechart diagram shows the states an object might be
in and the actions or conditions that cause an object to
make a transition from one state to another.
• By documenting events and transitions, a statechart
diagram shows the sequence of states an object goes
through during its life.
• Statecharts are extensions of the class diagram and you
could create one statechart for each class.
In practice, you will only create a statechart for those classes
that exhibit especially interesting or complex time-dependent
behavior.
Statechart Diagram
setFulfilledFlag
Shipped Shipping