Conquering
Complex
and
Changing
Systems
Object-Oriented
Software
Engineering
Chapter 2,
Modeling with UML
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 2
Overview
 What is modeling?
 What is UML?
 Use case diagrams
 Class diagrams
 Sequence diagrams
 Activity diagrams
 Summary
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 3
Systems, Models, and Views
 A model is an abstraction describing system or a subset of a
system
 A view depicts selected aspects of a model
 A notation is a set of graphical or textual rules for representing
views
 Views and models of a single system may overlap each other
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 4
Systems, Models, and Views
Airplane
Flightsimulator
Scale Model
Blueprints
Electrical
Wiring
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 5
Models, Views, and Systems (UML)
View
*
*
depicted by
described by
System Model
flightSimulator:Model
scaleModel:Model
blueprints:View
airplane:System
fuelSystem:View electricalWiring:View
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 6
Why model software?
Software is already an abstraction: why model software?
 Software is getting larger, not smaller
 NT 5.0 ~ 40 million lines of code
 A single programmer cannot manage this amount of code in its
entirety.
 Code is often not directly understandable by developers who
did not participate in the development
 We need simpler representations for complex systems
 Modeling is a mean for dealing with complexity
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 7
Concepts and Phenomena
 Phenomenon: An object in the world of a domain as you
perceive it, for example:
 The lecture you are attending
 My black watch
 Concept: Describes the properties of phenomena that are
common, for example:
 Lectures on software engineering
 Black watches
 A concept is a 3-tuple:
 Its Name distinguishes it from other concepts.
 Its Purpose are the properties that determine if a phenomenon is a
member of a concept.
 Its Members are the phenomena which are part of the concept.
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 8
 Abstraction: Classification of phenomena into concepts
 Modeling: Development of abstractions to answer specific
questions about a set of phenomena while ignoring irrelevant
details.
Members
Name
Clock
Purpose
A device that
measures time.
Concepts and Phenomena
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 9
Concepts In Software: Type and Instance
 Type:
 An abstraction in the context of programming languages
 Name: int, Purpose: integral number, Members: 0, -1, 1, 2,
-2, . . .
 Instance:
 Member of a specific type
 The type of a variable represents all possible instances the
variable can take.
 The relationship between “type” and “instance” is similar to
that of “concept” and “phenomenon.”
 Abstract data type:
 Special type whose implementation is hidden from the rest of the
system.
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 10
Class
 Class:
 An abstraction in the context of object-oriented languages
 Like an abstract data type, a class encapsulates both state
(variables) and behavior (methods)
 Unlike abstract data types, classes can be defined in terms of
other classes using inheritance
Watch
time
date
CalculatorWatch
SetDate(d)
EnterCalcMode()
InputNumber(n)
calculatorState
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 11
Object-Oriented Modeling
UML Package
Application Domain Solution Domain
Application Domain Model System Model
Aircraft
TrafficController
FlightPlan Airport
MapDisplay
FlightPlanDatabase
SummaryDisplay
TrafficControl
TrafficControl
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 12
Application and Solution Domain
 Application Domain (Requirements Analysis):
 The environment in which the system is operating
 Solution Domain (System Design, Object Design):
 The available technologies to build the system
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 13
What is UML?
 UML (Unified Modeling Language)
 An emerging standard for modeling object-oriented software.
 Resulted from the convergence of notations from three leading
object-oriented methods:
 OMT (James Rumbaugh)
 OOSE (Ivar Jacobson)
 Booch (Grady Booch)
 Reference: “The Unified Modeling Language User Guide”,
Addison Wesley, 1999.
 Supported by several CASE tools
 Rational ROSE
 Together/J
 ...
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 14
UML and This Course
 You can model 80% of most problems by using about 20%
UML
 In this course, we teach you those 20%
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 15
UML First Pass
 Use case diagrams
 Describe the functional behavior of the system as seen by the user.
 Class diagrams
 Describe the static structure of the system: Objects, Attributes, and
Associations.
 Sequence diagrams
 Describe the dynamic behavior between actors and the system and
between objects of the system.
 Statechart diagrams
 Describe the dynamic behavior of an individual object as a finite state
machine.
 Activity diagrams
 Model the dynamic behavior of a system, in particular the workflow,
i.e. a flowchart.
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 16
UML First Pass: Use Case Diagrams
WatchUser WatchRepairPerson
ReadTime
SetTime
ChangeBattery
Actor
Use case
Package
SimpleWatch
Use case diagrams represent the functionality of the system
from user’s point of view
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 17
UML First Pass: Class Diagrams
Battery
load()
1
2
Time
now()
PushButton
state
push()
release()
1
1
1
1
1
2
blinkIdx
blinkSeconds()
blinkMinutes()
blinkHours()
stopBlinking()
referesh()
LCDDisplay
SimpleWatch
Class
Association
Multiplicity
Attributes
Operations
Class diagrams represent the structure of the system
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 18
UML First Pass: Sequence Diagram
Object
Message
Activation
Sequence diagrams represent the behavior as interactions
blinkHours()
blinkMinutes()
incrementMinutes()
refresh()
commitNewTime()
stopBlinking()
pressButton1()
pressButton2()
pressButtons1And2()
pressButton1()
:WatchUser
:Time
:LCDDisplay
:SimpleWatch
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 19
button1&2Pressed
button1&2Pressed
button1Pressed
button2Pressed
button2Pressed
button2Pressed
button1Pressed
button1&2Pressed Increment
Minutes
Increment
Hours
Blink
Hours
Blink
Seconds
Blink
Minutes
Increment
Seconds
Stop
Blinking
UML First Pass: Statechart Diagrams
State
Initial state
Final state
Transition
Event
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 20
Other UML Notations
UML provide other notations that we will be introduced in
subsequent lectures, as needed.
 Implementation diagrams
 Component diagrams
 Deployment diagrams
 Introduced in lecture on System Design
 Object Constraint Language (OCL)
 Introduced in lecture on Object Design
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 21
UML Core Conventions
 Rectangles are classes or instances
 Ovals are functions or use cases
 Instances are denoted with an underlined names
 myWatch:SimpleWatch
 Joe:Firefighter
 Types are denoted with nonunderlined names
 SimpleWatch
 Firefighter
 Diagrams are graphs
 Nodes are entities
 Arcs are relationships between entities
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 22
UML Second Pass: Use Case Diagrams
Used during requirements elicitation to
represent external behavior
 Actors represent roles, that is, a type
of user of the system
 Use cases represent a sequence of
interaction for a type of functionality
 The use case model is the set of all
use cases. It is a complete description
of the functionality of the system and
its environment
Passenger
PurchaseTicket
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 23
Actors
 An actor models an external entity which
communicates with the system:
 User
 External system
 Physical environment
 An actor has a unique name and an optional
description.
 Examples:
 Passenger: A person in the train
 GPS satellite: Provides the system with GPS
coordinates
Passenger
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 24
Use Case
A use case represents a class of
functionality provided by the system as
an event flow.
A use case consists of:
 Unique name
 Participating actors
 Entry conditions
 Flow of events
 Exit conditions
 Special requirements
PurchaseTicket
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 25
Use Case Example
Name: Purchase ticket
Participating actor: Passenger
Entry condition:
 Passenger standing in front
of ticket distributor.
 Passenger has sufficient
money to purchase ticket.
Exit condition:
 Passenger has ticket.
Event flow:
1. Passenger selects the number
of zones to be traveled.
2. Distributor displays the
amount due.
3. Passenger inserts money, of
at least the amount due.
4. Distributor returns change.
5. Distributor issues ticket.
Anything missing?
Exceptional cases!
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 26
The <<extend>> Relationship
 <<extend>> relationships represent
exceptional or seldom invoked cases.
 The exceptional event flows are
factored out of the main event flow
for clarity.
 Use cases representing exceptional
flows can extend more than one use
case.
 The direction of a <<extend>>
relationship is to the extended use
case
Passenger
PurchaseTicket
TimeOut
<<extend>>
NoChange
<<extend>>
OutOfOrder
<<extend>>
Cancel
<<extend>>
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 27
Passenger
PurchaseSingleTicket
PurchaseMultiCard
NoChange
<<extend>>
Cancel
<<extend>>
<<include>>
CollectMoney
<<include>>
The <<include>> Relationship
 An <<include>>
relationship represents
behavior that is factored out
of the use case.
 An <<include>> represents
behavior that is factored out
for reuse, not because it is an
exception.
 The direction of a
<<include>> relationship is
to the using use case (unlike
<<extend>> relationships).
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 28
Class Diagrams
 Class diagrams represent the structure of the system.
 Class diagrams are used
 during requirements analysis to model problem domain concepts
 during system design to model subsystems and interfaces
 during object design to model classes.
Enumeration getZones()
Price getPrice(Zone)
TariffSchedule
* *
Trip
zone:Zone
price:Price
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 29
Classes
 A class represent a concept.
 A class encapsulates state (attributes) and behavior
(operations).
 Each attribute has a type.
 Each operation has a signature.
 The class name is the only mandatory information.
zone2price
getZones()
getPrice()
TariffSchedule
Table zone2price
Enumeration getZones()
Price getPrice(Zone)
TariffSchedule
Name
Attributes
Operations
Signature
TariffSchedule
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 30
Instances
 An instance represents a phenomenon.
 The name of an instance is underlined and can contain the class
of the instance.
 The attributes are represented with their values.
zone2price = {
{‘1’, .20},
{‘2’, .40},
{‘3’, .60}}
tariff_1974:TarifSchedule
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 31
Actor vs. Instances
 What is the difference between an actor and a class and an
instance?
 Actor:
 An entity outside the system to be modeled, interacting with the
system (“Pilot”)
 Class:
 An abstraction modeling an entity in the problem domain, inside the
system to be modeled (“Cockpit”)
 Object:
 A specific instance of a class (“Joe, the inspector”).
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 32
Associations
 Associations denote relationships between classes.
 The multiplicity of an association end denotes how many
objects the source object can legitimately reference.
Enumeration getZones()
Price getPrice(Zone)
TarifSchedule
*
price
zone
TripLeg
*
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 33
1-to-1 and 1-to-Many Associations
1-to-1 association
1-to-many association
*
draw()
Polygon
x:Integer
y:Integer
Point
1
Has-capital
name:String
Country
name:String
City
1
1
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 34
Aggregation
 An aggregation is a special case of association denoting a
“consists of” hierarchy.
 The aggregate is the parent class, the components are the
children class.
1
Exhaust System
Muffler Tailpipe
0..2
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 35
Composition
 A solid diamond denote composition, a strong form of
aggregation where components cannot exist without the
aggregate.
3
TicketMachine
ZoneButton
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 36
Generalization
 Generalization relationships denote inheritance between
classes.
 The children classes inherit the attributes and operations of the
parent class.
 Generalization simplifies the model by eliminating redundancy.
Button
ZoneButton
CancelButton
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 37
From Problem Statement to Code
Problem Statement
A stock exchange lists many companies. Each company is
identified by a ticker symbol
Class Diagram
Java Code
public class StockExchange {
public Vector m_Company = new Vector();
};
public class Company {
public int m_tickerSymbol;
public Vector m_StockExchange = new Vector();
};
*
StockExchange
tickerSymbol
Company
*
lists
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 38
UML Sequence Diagrams
 Used during requirements analysis
 To refine use case descriptions
 to find additional objects
(“participating objects”)
 Used during system design
 to refine subsystem interfaces
 Classes are represented by
columns
 Messages are represented by
arrows
 Activations are represented by
narrow rectangles
 Lifelines are represented by
dashed lines
selectZone()
pickupChange()
pickUpTicket()
insertCoins()
Passenger
TicketMachine
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 39
UML Sequence Diagrams: Nested Messages
 The source of an arrow indicates the activation which sent the
message
 An activation is as long as all nested activations
selectZone()
Passenger
ZoneButton TarifSchedule Display
lookupPrice(selection)
displayPrice(price)
price
Dataflow
…to be continued...
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 40
Sequence Diagram Observations
 UML sequence diagram represent behavior in terms of
interactions.
 Complement the class diagrams which represent structure.
 Useful to find participating objects.
 Time consuming to build but worth the investment.
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 41
Activity Diagrams
 An activity diagram shows flow control within a system
 An activity diagram is a special case of a state chart diagram in
which states are activities (“functions”)
 Two types of states:
 Action state:
 Cannot be decomposed any further
 Happens “instantaneously” with respect to the level of abstraction
used in the model
 Activity state:
 Can be decomposed further
 The activity is modeled by another activity diagram
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 42
Activity Diagram: Modeling Decisions
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 43
Activity Diagrams: Modeling Concurrency
 Synchronization of multiple activities
 Splitting the flow of control into multiple threads
Synchronization
Splitting
Archive
Incident
Open
Incident
Document
Incident
Allocate
Resources
Coordinate
Resources
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 44
Activity Diagrams: Swimlanes
 Actions may be grouped into swimlanes to denote the object or
subsystem that implements the actions.
Archive
Incident
Dispatcher
FieldOfficer
Open
Incident
Document
Incident
Allocate
Resources
Coordinate
Resources
Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 45
Summary
 UML provides a wide variety of notations for representing
many aspects of software development
 Powerful, but complex language
 Can be misused to generate unreadable models
 Can be misunderstood when using too many exotic features
 We concentrate only on a few notations:
 Functional model: use case diagram
 Object model: class diagram
 Dynamic model: sequence diagrams, statechart and activity
diagrams

More Related Content

PPT
COCOMO Model
DOC
Programming in c notes
PPT
Software Design Patterns
PPTX
Software maintenance
PDF
DATA STRUCTURE.pdf
PPT
Crc cards
PPT
PPTX
Java/Servlet/JSP/JDBC
COCOMO Model
Programming in c notes
Software Design Patterns
Software maintenance
DATA STRUCTURE.pdf
Crc cards
Java/Servlet/JSP/JDBC

What's hot (20)

PPTX
software project management Waterfall model
PPT
Graphical User Interface in JAVA
PPTX
JAVA-PPT'S-complete-chrome.pptx
PPTX
waterfall model
PPTX
Android ui with xml
PDF
Software Engineering TESTING AND MAINTENANCE
PPT
UML Diagrams, examples, descriptions and tutorials
PDF
Reliability growth models
PPTX
Software requirements specification
PPTX
Static analysis
PPT
Software development life cycle
PPTX
Compiler Design Introduction
PPTX
Software testing strategies
PDF
What is agile model
PPTX
Software Development Life Cycle-SDLC
PPT
PDF
Software Development Life Cycle (SDLC)
PDF
FDD Overview
PDF
Core java course syllabus
PPT
software project management Waterfall model
Graphical User Interface in JAVA
JAVA-PPT'S-complete-chrome.pptx
waterfall model
Android ui with xml
Software Engineering TESTING AND MAINTENANCE
UML Diagrams, examples, descriptions and tutorials
Reliability growth models
Software requirements specification
Static analysis
Software development life cycle
Compiler Design Introduction
Software testing strategies
What is agile model
Software Development Life Cycle-SDLC
Software Development Life Cycle (SDLC)
FDD Overview
Core java course syllabus
Ad

Similar to ch2lect.ppt (20)

PPT
UML and Machine Theory with examples and
PPT
Sequence of Unified modelling language for MSA
PPT
uml moddelling ,use case,class diagram,interaction diagrametc.
PPT
Sequence diagram to assist learners to understand UML
PPT
ch02lect1.ppt
PPT
ch02lect1.ppt learning education for all students
PPT
Notacion uml
PPT
Ch02lect1 ud
PPT
Introduction to Information Technology For IT
PPT
ch01lect1.ppt
PPT
software engineering chapte r one Btech
PPT
Object Oriented Analysis and Design with UML2 part1
PDF
0136061257
PPT
Chapter1
PPTX
Designmethodology1
PPT
System Modelling.ppt
PDF
Lecture 4.pdf
PDF
A novel methodology for test scenario generation based on control flow analys...
PPTX
PPTX
Chapter 2_NEW-An overview of UMLupdated.pptx
UML and Machine Theory with examples and
Sequence of Unified modelling language for MSA
uml moddelling ,use case,class diagram,interaction diagrametc.
Sequence diagram to assist learners to understand UML
ch02lect1.ppt
ch02lect1.ppt learning education for all students
Notacion uml
Ch02lect1 ud
Introduction to Information Technology For IT
ch01lect1.ppt
software engineering chapte r one Btech
Object Oriented Analysis and Design with UML2 part1
0136061257
Chapter1
Designmethodology1
System Modelling.ppt
Lecture 4.pdf
A novel methodology for test scenario generation based on control flow analys...
Chapter 2_NEW-An overview of UMLupdated.pptx
Ad

More from KalsoomTahir2 (20)

PDF
005813616.pdf
PDF
009576860.pdf
PDF
005813185.pdf
PDF
HASH FUNCTIONS.pdf
PPTX
6. McCall's Model.pptx
PPT
ch02-Database System Concepts and Architecture.ppt
PPT
9223301.ppt
PPT
11885558.ppt
PPT
Indexing.ppt
PPT
chap05-info366.ppt
PPT
1650607.ppt
PDF
005281271.pdf
PPT
soa_and_jra.ppt
PPT
ERP_Up_Down.ppt
PPT
Topic1CourseIntroduction.ppt
PPT
Lecture 19 - Dynamic Web - JAVA - Part 1.ppt
PPT
CommercialSystemsBahman.ppt
PPT
EJBDetailsFeb25.ppt
PPT
jan28EAI.ppt
PDF
005428052.pdf
005813616.pdf
009576860.pdf
005813185.pdf
HASH FUNCTIONS.pdf
6. McCall's Model.pptx
ch02-Database System Concepts and Architecture.ppt
9223301.ppt
11885558.ppt
Indexing.ppt
chap05-info366.ppt
1650607.ppt
005281271.pdf
soa_and_jra.ppt
ERP_Up_Down.ppt
Topic1CourseIntroduction.ppt
Lecture 19 - Dynamic Web - JAVA - Part 1.ppt
CommercialSystemsBahman.ppt
EJBDetailsFeb25.ppt
jan28EAI.ppt
005428052.pdf

Recently uploaded (20)

PPTX
Diploma pharmaceutics notes..helps diploma students
PPT
REGULATION OF RESPIRATION lecture note 200L [Autosaved]-1-1.ppt
PDF
African Communication Research: A review
PPTX
ACFE CERTIFICATION TRAINING ON LAW.pptx
PDF
MICROENCAPSULATION_NDDS_BPHARMACY__SEM VII_PCI Syllabus.pdf
PDF
M.Tech in Aerospace Engineering | BIT Mesra
PDF
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2015).pdf
PPTX
Integrated Management of Neonatal and Childhood Illnesses (IMNCI) – Unit IV |...
PDF
faiz-khans about Radiotherapy Physics-02.pdf
PDF
Lecture on Viruses: Structure, Classification, Replication, Effects on Cells,...
PPTX
2025 High Blood Pressure Guideline Slide Set.pptx
PDF
0520_Scheme_of_Work_(for_examination_from_2021).pdf
PDF
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
PDF
Laparoscopic Colorectal Surgery at WLH Hospital
PDF
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2013).pdf
PPTX
Reproductive system-Human anatomy and physiology
PDF
anganwadi services for the b.sc nursing and GNM
PDF
Nurlina - Urban Planner Portfolio (english ver)
PDF
Journal of Dental Science - UDMY (2022).pdf
PDF
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
Diploma pharmaceutics notes..helps diploma students
REGULATION OF RESPIRATION lecture note 200L [Autosaved]-1-1.ppt
African Communication Research: A review
ACFE CERTIFICATION TRAINING ON LAW.pptx
MICROENCAPSULATION_NDDS_BPHARMACY__SEM VII_PCI Syllabus.pdf
M.Tech in Aerospace Engineering | BIT Mesra
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2015).pdf
Integrated Management of Neonatal and Childhood Illnesses (IMNCI) – Unit IV |...
faiz-khans about Radiotherapy Physics-02.pdf
Lecture on Viruses: Structure, Classification, Replication, Effects on Cells,...
2025 High Blood Pressure Guideline Slide Set.pptx
0520_Scheme_of_Work_(for_examination_from_2021).pdf
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
Laparoscopic Colorectal Surgery at WLH Hospital
Myanmar Dental Journal, The Journal of the Myanmar Dental Association (2013).pdf
Reproductive system-Human anatomy and physiology
anganwadi services for the b.sc nursing and GNM
Nurlina - Urban Planner Portfolio (english ver)
Journal of Dental Science - UDMY (2022).pdf
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf

ch2lect.ppt

  • 2. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 2 Overview  What is modeling?  What is UML?  Use case diagrams  Class diagrams  Sequence diagrams  Activity diagrams  Summary
  • 3. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 3 Systems, Models, and Views  A model is an abstraction describing system or a subset of a system  A view depicts selected aspects of a model  A notation is a set of graphical or textual rules for representing views  Views and models of a single system may overlap each other
  • 4. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 4 Systems, Models, and Views Airplane Flightsimulator Scale Model Blueprints Electrical Wiring
  • 5. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 5 Models, Views, and Systems (UML) View * * depicted by described by System Model flightSimulator:Model scaleModel:Model blueprints:View airplane:System fuelSystem:View electricalWiring:View
  • 6. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 6 Why model software? Software is already an abstraction: why model software?  Software is getting larger, not smaller  NT 5.0 ~ 40 million lines of code  A single programmer cannot manage this amount of code in its entirety.  Code is often not directly understandable by developers who did not participate in the development  We need simpler representations for complex systems  Modeling is a mean for dealing with complexity
  • 7. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 7 Concepts and Phenomena  Phenomenon: An object in the world of a domain as you perceive it, for example:  The lecture you are attending  My black watch  Concept: Describes the properties of phenomena that are common, for example:  Lectures on software engineering  Black watches  A concept is a 3-tuple:  Its Name distinguishes it from other concepts.  Its Purpose are the properties that determine if a phenomenon is a member of a concept.  Its Members are the phenomena which are part of the concept.
  • 8. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 8  Abstraction: Classification of phenomena into concepts  Modeling: Development of abstractions to answer specific questions about a set of phenomena while ignoring irrelevant details. Members Name Clock Purpose A device that measures time. Concepts and Phenomena
  • 9. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 9 Concepts In Software: Type and Instance  Type:  An abstraction in the context of programming languages  Name: int, Purpose: integral number, Members: 0, -1, 1, 2, -2, . . .  Instance:  Member of a specific type  The type of a variable represents all possible instances the variable can take.  The relationship between “type” and “instance” is similar to that of “concept” and “phenomenon.”  Abstract data type:  Special type whose implementation is hidden from the rest of the system.
  • 10. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 10 Class  Class:  An abstraction in the context of object-oriented languages  Like an abstract data type, a class encapsulates both state (variables) and behavior (methods)  Unlike abstract data types, classes can be defined in terms of other classes using inheritance Watch time date CalculatorWatch SetDate(d) EnterCalcMode() InputNumber(n) calculatorState
  • 11. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 11 Object-Oriented Modeling UML Package Application Domain Solution Domain Application Domain Model System Model Aircraft TrafficController FlightPlan Airport MapDisplay FlightPlanDatabase SummaryDisplay TrafficControl TrafficControl
  • 12. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 12 Application and Solution Domain  Application Domain (Requirements Analysis):  The environment in which the system is operating  Solution Domain (System Design, Object Design):  The available technologies to build the system
  • 13. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 13 What is UML?  UML (Unified Modeling Language)  An emerging standard for modeling object-oriented software.  Resulted from the convergence of notations from three leading object-oriented methods:  OMT (James Rumbaugh)  OOSE (Ivar Jacobson)  Booch (Grady Booch)  Reference: “The Unified Modeling Language User Guide”, Addison Wesley, 1999.  Supported by several CASE tools  Rational ROSE  Together/J  ...
  • 14. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 14 UML and This Course  You can model 80% of most problems by using about 20% UML  In this course, we teach you those 20%
  • 15. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 15 UML First Pass  Use case diagrams  Describe the functional behavior of the system as seen by the user.  Class diagrams  Describe the static structure of the system: Objects, Attributes, and Associations.  Sequence diagrams  Describe the dynamic behavior between actors and the system and between objects of the system.  Statechart diagrams  Describe the dynamic behavior of an individual object as a finite state machine.  Activity diagrams  Model the dynamic behavior of a system, in particular the workflow, i.e. a flowchart.
  • 16. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 16 UML First Pass: Use Case Diagrams WatchUser WatchRepairPerson ReadTime SetTime ChangeBattery Actor Use case Package SimpleWatch Use case diagrams represent the functionality of the system from user’s point of view
  • 17. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 17 UML First Pass: Class Diagrams Battery load() 1 2 Time now() PushButton state push() release() 1 1 1 1 1 2 blinkIdx blinkSeconds() blinkMinutes() blinkHours() stopBlinking() referesh() LCDDisplay SimpleWatch Class Association Multiplicity Attributes Operations Class diagrams represent the structure of the system
  • 18. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 18 UML First Pass: Sequence Diagram Object Message Activation Sequence diagrams represent the behavior as interactions blinkHours() blinkMinutes() incrementMinutes() refresh() commitNewTime() stopBlinking() pressButton1() pressButton2() pressButtons1And2() pressButton1() :WatchUser :Time :LCDDisplay :SimpleWatch
  • 19. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 19 button1&2Pressed button1&2Pressed button1Pressed button2Pressed button2Pressed button2Pressed button1Pressed button1&2Pressed Increment Minutes Increment Hours Blink Hours Blink Seconds Blink Minutes Increment Seconds Stop Blinking UML First Pass: Statechart Diagrams State Initial state Final state Transition Event
  • 20. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 20 Other UML Notations UML provide other notations that we will be introduced in subsequent lectures, as needed.  Implementation diagrams  Component diagrams  Deployment diagrams  Introduced in lecture on System Design  Object Constraint Language (OCL)  Introduced in lecture on Object Design
  • 21. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 21 UML Core Conventions  Rectangles are classes or instances  Ovals are functions or use cases  Instances are denoted with an underlined names  myWatch:SimpleWatch  Joe:Firefighter  Types are denoted with nonunderlined names  SimpleWatch  Firefighter  Diagrams are graphs  Nodes are entities  Arcs are relationships between entities
  • 22. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 22 UML Second Pass: Use Case Diagrams Used during requirements elicitation to represent external behavior  Actors represent roles, that is, a type of user of the system  Use cases represent a sequence of interaction for a type of functionality  The use case model is the set of all use cases. It is a complete description of the functionality of the system and its environment Passenger PurchaseTicket
  • 23. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 23 Actors  An actor models an external entity which communicates with the system:  User  External system  Physical environment  An actor has a unique name and an optional description.  Examples:  Passenger: A person in the train  GPS satellite: Provides the system with GPS coordinates Passenger
  • 24. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 24 Use Case A use case represents a class of functionality provided by the system as an event flow. A use case consists of:  Unique name  Participating actors  Entry conditions  Flow of events  Exit conditions  Special requirements PurchaseTicket
  • 25. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 25 Use Case Example Name: Purchase ticket Participating actor: Passenger Entry condition:  Passenger standing in front of ticket distributor.  Passenger has sufficient money to purchase ticket. Exit condition:  Passenger has ticket. Event flow: 1. Passenger selects the number of zones to be traveled. 2. Distributor displays the amount due. 3. Passenger inserts money, of at least the amount due. 4. Distributor returns change. 5. Distributor issues ticket. Anything missing? Exceptional cases!
  • 26. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 26 The <<extend>> Relationship  <<extend>> relationships represent exceptional or seldom invoked cases.  The exceptional event flows are factored out of the main event flow for clarity.  Use cases representing exceptional flows can extend more than one use case.  The direction of a <<extend>> relationship is to the extended use case Passenger PurchaseTicket TimeOut <<extend>> NoChange <<extend>> OutOfOrder <<extend>> Cancel <<extend>>
  • 27. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 27 Passenger PurchaseSingleTicket PurchaseMultiCard NoChange <<extend>> Cancel <<extend>> <<include>> CollectMoney <<include>> The <<include>> Relationship  An <<include>> relationship represents behavior that is factored out of the use case.  An <<include>> represents behavior that is factored out for reuse, not because it is an exception.  The direction of a <<include>> relationship is to the using use case (unlike <<extend>> relationships).
  • 28. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 28 Class Diagrams  Class diagrams represent the structure of the system.  Class diagrams are used  during requirements analysis to model problem domain concepts  during system design to model subsystems and interfaces  during object design to model classes. Enumeration getZones() Price getPrice(Zone) TariffSchedule * * Trip zone:Zone price:Price
  • 29. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 29 Classes  A class represent a concept.  A class encapsulates state (attributes) and behavior (operations).  Each attribute has a type.  Each operation has a signature.  The class name is the only mandatory information. zone2price getZones() getPrice() TariffSchedule Table zone2price Enumeration getZones() Price getPrice(Zone) TariffSchedule Name Attributes Operations Signature TariffSchedule
  • 30. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 30 Instances  An instance represents a phenomenon.  The name of an instance is underlined and can contain the class of the instance.  The attributes are represented with their values. zone2price = { {‘1’, .20}, {‘2’, .40}, {‘3’, .60}} tariff_1974:TarifSchedule
  • 31. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 31 Actor vs. Instances  What is the difference between an actor and a class and an instance?  Actor:  An entity outside the system to be modeled, interacting with the system (“Pilot”)  Class:  An abstraction modeling an entity in the problem domain, inside the system to be modeled (“Cockpit”)  Object:  A specific instance of a class (“Joe, the inspector”).
  • 32. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 32 Associations  Associations denote relationships between classes.  The multiplicity of an association end denotes how many objects the source object can legitimately reference. Enumeration getZones() Price getPrice(Zone) TarifSchedule * price zone TripLeg *
  • 33. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 33 1-to-1 and 1-to-Many Associations 1-to-1 association 1-to-many association * draw() Polygon x:Integer y:Integer Point 1 Has-capital name:String Country name:String City 1 1
  • 34. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 34 Aggregation  An aggregation is a special case of association denoting a “consists of” hierarchy.  The aggregate is the parent class, the components are the children class. 1 Exhaust System Muffler Tailpipe 0..2
  • 35. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 35 Composition  A solid diamond denote composition, a strong form of aggregation where components cannot exist without the aggregate. 3 TicketMachine ZoneButton
  • 36. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 36 Generalization  Generalization relationships denote inheritance between classes.  The children classes inherit the attributes and operations of the parent class.  Generalization simplifies the model by eliminating redundancy. Button ZoneButton CancelButton
  • 37. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 37 From Problem Statement to Code Problem Statement A stock exchange lists many companies. Each company is identified by a ticker symbol Class Diagram Java Code public class StockExchange { public Vector m_Company = new Vector(); }; public class Company { public int m_tickerSymbol; public Vector m_StockExchange = new Vector(); }; * StockExchange tickerSymbol Company * lists
  • 38. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 38 UML Sequence Diagrams  Used during requirements analysis  To refine use case descriptions  to find additional objects (“participating objects”)  Used during system design  to refine subsystem interfaces  Classes are represented by columns  Messages are represented by arrows  Activations are represented by narrow rectangles  Lifelines are represented by dashed lines selectZone() pickupChange() pickUpTicket() insertCoins() Passenger TicketMachine
  • 39. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 39 UML Sequence Diagrams: Nested Messages  The source of an arrow indicates the activation which sent the message  An activation is as long as all nested activations selectZone() Passenger ZoneButton TarifSchedule Display lookupPrice(selection) displayPrice(price) price Dataflow …to be continued...
  • 40. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 40 Sequence Diagram Observations  UML sequence diagram represent behavior in terms of interactions.  Complement the class diagrams which represent structure.  Useful to find participating objects.  Time consuming to build but worth the investment.
  • 41. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 41 Activity Diagrams  An activity diagram shows flow control within a system  An activity diagram is a special case of a state chart diagram in which states are activities (“functions”)  Two types of states:  Action state:  Cannot be decomposed any further  Happens “instantaneously” with respect to the level of abstraction used in the model  Activity state:  Can be decomposed further  The activity is modeled by another activity diagram
  • 42. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 42 Activity Diagram: Modeling Decisions
  • 43. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 43 Activity Diagrams: Modeling Concurrency  Synchronization of multiple activities  Splitting the flow of control into multiple threads Synchronization Splitting Archive Incident Open Incident Document Incident Allocate Resources Coordinate Resources
  • 44. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 44 Activity Diagrams: Swimlanes  Actions may be grouped into swimlanes to denote the object or subsystem that implements the actions. Archive Incident Dispatcher FieldOfficer Open Incident Document Incident Allocate Resources Coordinate Resources
  • 45. Bernd Bruegge & Allen Dutoit Object-Oriented Software Engineering: Conquering Complex and Changing Systems 45 Summary  UML provides a wide variety of notations for representing many aspects of software development  Powerful, but complex language  Can be misused to generate unreadable models  Can be misunderstood when using too many exotic features  We concentrate only on a few notations:  Functional model: use case diagram  Object model: class diagram  Dynamic model: sequence diagrams, statechart and activity diagrams