SlideShare a Scribd company logo
INTROSE  Introduction to Software Engineering Raymund Sison, PhD College of Computer Studies De La Salle University [email_address] Modeling Software Systems
How do we model complex systems? Epistemology Knowledge about Causality (Dynamic Model) Describes our  knowledge about the system  Knowledge about Functionality (Functional model) Knowledge about Relationships (Object model) From (Bruegge & Dutoit, 2004) Neural  Networks DataFlow Diagrams (SA/SD) Scenarios/Use Cases (Jacobsen) Formal Specifications (Liskov) Petri Nets(Petri) Inheritance  Frames,SemanticNetworks (Minsky) Uncertain Knowledge Fuzzy Sets (Zadeh) Data Relationship (E/R Modeling, Chen) Hierarchical Database Model (IMS) Network Database Model (CODASYL) Relational Database Model (Codd) Fuzzy Frames (Graham) Class Diagrams (“E/R + Inheritance”,  Rumbaugh) Sequence  Diagrams (Lamport) Activity Diagrams (“good old Flowcharts”)
How do we model  complex systems? Epistemology Knowledge about Causality (Dynamic Model) Describes our  knowledge about the system  Knowledge about Functionality (Functional model) Knowledge about Relationships (Object model) From (Bruegge & Dutoit, 2004) Neural  Networks DataFlow Diagrams (SA/SD) Scenarios/Use Cases (Jacobsen) Formal Specifications (Liskov) Petri Nets(Petri) Inheritance  Frames,SemanticNetworks (Minsky) Uncertain Knowledge Fuzzy Sets (Zadeh) Data Relationship (E/R Modeling, Chen) Hierarchical Database Model (IMS) Network Database Model (CODASYL) Relational Database Model (Codd) Fuzzy Frames (Graham) Class Diagrams (“E/R + Inheritance”,  Rumbaugh) Sequence  Diagrams (Lamport) Activity Diagrams (“good old Flowcharts”)
Components of an Object Model Classes Associations (Relations) Kind-of/Is-a (Generalization) Part-of/Has-a (Aggregation) Domain-specific associations Attributes Operations
UML Classes A  class  is simply represented as a box with the name of the class inside   The diagram may also show the attributes and operations The complete signature of an operation is:  operationName(parameterName: parameterType …): returnType   Class Diagram slides from (Lethbridge & Laganiere, 2005)
Associations and Multiplicity   An  association  is used to show how two classes are related to each other Symbols indicating  multiplicity  are shown at each end of the association
Labelling Associations   Each association can be labelled, to make explicit the nature of the association
Analyzing and Validating Associations Many-to-one A company has many employees,  An employee can only work for one company. This company will not store data about the moonlighting activities of employees!  A company can have zero employees E.g. a ‘shell’ company It is not possible to be an employee unless you work for a company * worksFor Employee Company 1
Analyzing and Validating Associations Many-to-many An assistant can work for many managers A manager can have many assistants Assistants can work in pools Managers can have a group of assistants Some managers might have zero assistants.  Is it possible for an assistant to have, perhaps temporarily, zero managers? * supervisor * * * * * 1..* Assistant Manager
Analyzing and Validating Associations One-to-one For each company, there is exactly one board of directors A board is the board of only one company A company must always have a board A board must always be of some company   1 1
Analyzing and Validating Associations Avoid unnecessary one-to-one associations Avoid this  Do this
A More Complex Example A booking is always for exactly one passenger   no booking with zero passengers a booking could  never  involve more than one passenger.   A Passenger can have any number of Bookings a passenger could have no bookings at all a passenger could have more than one booking The  frame  around this diagram is an optional feature that any UML 2.0 may possess.
Association Classes   Sometimes, an attribute that concerns two associated classes cannot be placed in either of the classes   The following are equivalent
Reflexive Associations It is possible for an association to connect a class to itself
Directionality in Associations   Associations are by default  bi-directional   It is possible to limit the direction of an association by adding an arrow at one end
Generalization   Specializing a superclass into two or more subclasses A  generalization set  is a labeled group of generalizations with a common superclass The label (sometimes called the  discriminator ) describes the criteria used in the specialization
Avoiding Unnecessary Generalizations   Inappropriate hierarchy of classes, which should be instances
Avoiding Unnecessary Generalizations Improved class diagram, with its corresponding instance diagram
Handling Multiple Discriminators Creating higher-level generalization
Handling Multiple Discriminators Using multiple inheritance
Object Diagrams   A  link  is an instance of an association (in the same way that we say an object is an instance of a class)
Associations vs. Generalizations in Object Diagrams   Associations describe the relationships that will exist between  instances  at run time.  When you show an instance diagram generated from a class diagram, there will be an instance of  both  classes joined by an association Generalizations describe relationships between  classes  in class diagrams.  They do not appear in instance diagrams at all.  An instance of any class should also be considered to be an instance of each of that class’s superclasses
Aggregation   Aggregations  are special associations that represent ‘part-whole’ relationships.  The ‘whole’ side is often called the  assembly  or the  aggregate   This symbol is a shorthand notation association named  isPartOf
When to Use an Aggregation As a general rule, you can mark an association as an aggregation if the following are true:   You can state that the parts ‘are part of’ the aggregate or the aggregate ‘is composed of’ the parts   When something owns or controls the aggregate, then they also own or control the parts
Composition A  composition  is a strong kind of aggregation  If the aggregate is destroyed, then the parts are destroyed as well   Two alternatives for addresses
Aggregation Hierarchy
Propagation A mechanism where an operation in an aggregate is implemented by having the aggregate perform that operation on its parts At the same time, properties of the parts are often propagated back to the aggregate   Propagation is to aggregation as inheritance is to generalization.  The major difference is: inheritance is an implicit mechanism propagation has to be programmed when required
Interfaces   An interface describes a  portion of the visible behavior  of a set of objects. An  interface  is similar to a class, except it lacks instance variables and implemented methods
Notes and Descriptive Text   Descriptive text and other diagrams Embed your diagrams in a larger document  Text can explain aspects of the system using any notation you like Highlight and expand on important features, and give rationale Notes :  A note is a small block of text embedded  in  a UML diagram It acts like a comment in a programming language
How do we model complex systems? Epistemology Knowledge about Causality (Dynamic Model) Describes our  knowledge about the system  Knowledge about Functionality (Functional model) Knowledge about Relationships (Object model) From (Bruegge & Dutoit, 2004) Neural  Networks DataFlow Diagrams (SA/SD) Scenarios/Use Cases (Jacobsen) Formal Specifications (Liskov) Petri Nets(Petri) Inheritance  Frames,SemanticNetworks (Minsky) Uncertain Knowledge Fuzzy Sets (Zadeh) Data Relationship (E/R Modeling, Chen) Hierarchical Database Model (IMS) Network Database Model (CODASYL) Relational Database Model (Codd) Fuzzy Frames (Graham) Class Diagrams (“E/R + Inheritance”,  Rumbaugh) Sequence  Diagrams (Lamport) Activity Diagrams (“good old Flowcharts”)
UML Interaction Diagrams Model  the dynamic aspects of the system by showing relationships among objects and the messages they may dispatch Capture the behavior of a  single use case Show a number of example objects and the messages that are passed between these objects within the use case
UML Interaction Diagrams Sequence Diagram Emphasizes the time ordering of messages Focuses on the chronological course of the messages Collaboration Diagram Emphasizes the organization of the objects that participate in an interaction Focuses on the cooperation among objects
UML Collaboration Diagram Shows a set of interactions between selected objects in a specific, limited situation, focusing on the relations between the objects and their topology The chronological course of communication with each other is marked by numbering the messages Shows the chronological sequences of the messages, their names and responses, and their possible arguments One collaboration diagram for each use case
Link Links between objects are like associations in the class model Enables objects to send messages There should be an association in the class model between the two link objects Links may be instances of associations that are shown in the class diagram
Message Links may be labeled with the names of messages A communication between two objects that conveys information with the expectation that action will ensue An event sent from one object to another An operation being invoked on another object Creation or destruction of an object instance
Collaboration Diagram Show objects and links Superimpose messages on links a : Assembly part : CatalogEntry 1.1: number = getNumber() 1 : count(part) : Client
Collaboration Diagram course_form : CourseForm theManager : CurriculumManager aCourse : Course 4 : <<create>> 3 : add_course() 1 : set_course_info() 2 : process_form() : Registrar
Message Sequence Sequence of messages are determined by numbering Defines the order in which the interaction takes place 1, 2, 3, 4, ….. 1, 1.1, 1.2, 1.3, 2, 2.1, 2.1.1, 2.2, 3  (shows which operation calls which other operation)
Sequence Diagram Used to show the same interaction in a collaboration diagram but emphasize the  order of the messages over time Object instances are arranged horizontally across the page Time runs vertically down the page Messages flow from left to right or from right to left
Sequence Diagram Time Objects and Message Flows
Lifeline Objects are displayed at the top of the diagram The vertical dimension represents  time Each object has a dashed line –  lifeline  – extending below it – to indicate the period of time during which objects playing that role actually exist Object Name
Message The messages in an interaction are drawn from  top to bottom , in the order that they are sent.   Messages are shown as  arrows  pointing from the lifeline of the role sending the message to the lifeline of the receiver. When a  message is sent , control passes from the sender of the message to the receiver. Object Name Object Name message
Return Return of control  is shown using dashed arrow returning to the calling object. Object Name Object Name message
Activation Period of time  during which an object is processing a message Shown on a lifeline as a  narrow rectangle  whose top is connected to a message When an object finishes processing a message, control returns to the sender of the message
Sequence Diagram a : Assembly part : CatalogEntry getNumber() count(part) return number Lifeline Activation(optional) Messages control returns to the sender of the message (optional) : Client
Hierarchical Numbering of Messages 1.1 1 1.2 2 2.1 2.2 2.2.1 2.1.1 2.1.2
Object Creation course_form : CourseForm theManager : CurriculumManager aCourse : Course set_course_info process_form add_course <<create>> Object creation : Registrar
Object Creation: Order Entry Example Order OrderLine quantity: integer cost: float CatalogEntry 1 * 1 * : Client : Order : CatalogEntry OrderLine(qty,part) add(qty,part) : OrderLine getCost() return cost Object creation
Object Destruction: Order Entry Example : Order <<destroy>> remove(line) : OrderLine X : Client Object deletion
Recurrence When a sequence of messages takes place within an  iteration , messages are grouped together within a rectangle Object Name Object Name Object Name message message *[recurrence condition]
Branching Shown by 2 arrows branching off from the same point Condition-clause  is added to the message to show the condition Object Name Object Name Object Name [condition] message [condition] message
Conditional Message Messages which are sent only under certain circumstances Not used in most cases because of the complexity of the resulting diagrams Consists of a Boolean expression written in square brackets
Conditional Message: Sequence Diagram : Order : CatalogEntry [s>=qty]  OrderLine(qty,part) add(qty,part) : OrderLine getCost() return cost getStockLevel(part) return s : Client
Conditional Message: Communication Diagram : Order : OrderLine {new} : CatalogEntry 1: add(qty, part) 1.2:  [s>=qty]  OrderLine(qty, part) 1.2.1: cost = getCost() {new} {new} 1.1: s = getStockLevel(part) : Client
Message to Self A message that an object sends to itself gives rise to a new activation The new activation takes place in an object that already has a live activation The recursive nature of this new activation is shown by superimposing the new activation on top of the original one
Self-Delegation:  Sequence Diagram : Order : Customer getShippingCost() getTotal() : OrderLine  * getLocation() * getValue() : Client
Self-Delegation:  Collaboration Diagram : Order : Customer : OrderLine  * 1: getTotal() 1.2.1: getLocation() 1.1 * : getValue() 1.2: getShippingCost() <<self>> : Client

More Related Content

What's hot (20)

PPT
Use case Diagram and Sequence Diagram
Nikhil Pandit
 
PPTX
Uml Diagrams
Nirmal Sharma
 
PPTX
Unified Modeling Language
surana college
 
PPTX
Class diagram, use case and sequence diagram
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
unified modelling language(UML) diagrams
pratyashi satapathy
 
PPT
M02 Uml Overview
Dang Tuan
 
PPT
UML- Unified Modeling Language
Shahzad
 
PPT
Uml diagrams
barney92
 
PPT
Collaboration Diagram
fahad_uaar
 
PPT
Intro to UML 2
rchakra
 
PDF
SE_Lec 09_ UML Behaviour Diagrams
Amr E. Mohamed
 
PPTX
Lecture#02, building blocks of uml ASE
babak danyal
 
PPT
34. uml
karzansaid
 
PDF
Unified Modeling Language
Prof. Erwin Globio
 
PPT
analysis and design with uml
sabin kafle
 
PPTX
Understanding unified modelling language
Emmanuel Kumah
 
PDF
UML Diagrams- Unified Modeling Language Introduction
Ramakant Soni
 
PDF
Sequence diagram- UML diagram
Ramakant Soni
 
PPT
Uml sequence diagrams
ASHOK KUMAR PALAKI
 
Use case Diagram and Sequence Diagram
Nikhil Pandit
 
Uml Diagrams
Nirmal Sharma
 
Unified Modeling Language
surana college
 
Class diagram, use case and sequence diagram
baabtra.com - No. 1 supplier of quality freshers
 
unified modelling language(UML) diagrams
pratyashi satapathy
 
M02 Uml Overview
Dang Tuan
 
UML- Unified Modeling Language
Shahzad
 
Uml diagrams
barney92
 
Collaboration Diagram
fahad_uaar
 
Intro to UML 2
rchakra
 
SE_Lec 09_ UML Behaviour Diagrams
Amr E. Mohamed
 
Lecture#02, building blocks of uml ASE
babak danyal
 
34. uml
karzansaid
 
Unified Modeling Language
Prof. Erwin Globio
 
analysis and design with uml
sabin kafle
 
Understanding unified modelling language
Emmanuel Kumah
 
UML Diagrams- Unified Modeling Language Introduction
Ramakant Soni
 
Sequence diagram- UML diagram
Ramakant Soni
 
Uml sequence diagrams
ASHOK KUMAR PALAKI
 

Viewers also liked (18)

PDF
Planning-Based Approach for Automating Sequence Diagram Generation
Yaser Sulaiman
 
PPTX
"Just Enough" System Modeling
Prof. Amir Tomer
 
PDF
Agile Software Development With SCRUM
Alexey Krivitsky
 
PPTX
Diagrams
janessa24
 
PPT
Contracting for Agile Software Development
cspag67
 
PDF
Intro Agile Software Development with Scrum for Campus Party 2009
Antonio Silveira
 
PPT
Lecture#08 sequence diagrams
babak danyal
 
PPT
Software Engineering: Models
David Millard
 
PPTX
Sequence diagrams in UML
Paxcel Technologies
 
PPTX
Class, Collaboration, Sequence Diagram of a sample project
Naimul Arif
 
PDF
INTRODUCTION TO UML DIAGRAMS
Ashita Agrawal
 
PPT
System Models in Software Engineering SE7
koolkampus
 
PDF
High Quality Software Development with Agile and Scrum
Lemi Orhan Ergin
 
PPTX
Ch5- Software Engineering 9
Ian Sommerville
 
PPT
UML diagrams and symbols
Kumar
 
PPT
OOAD UNIT I UML DIAGRAMS
Mikel Raj
 
PDF
Modeling objects interaction via UML sequence diagrams [Software Modeling] [...
Ivano Malavolta
 
PPTX
Overview of Agile Methodology
Haresh Karkar
 
Planning-Based Approach for Automating Sequence Diagram Generation
Yaser Sulaiman
 
"Just Enough" System Modeling
Prof. Amir Tomer
 
Agile Software Development With SCRUM
Alexey Krivitsky
 
Diagrams
janessa24
 
Contracting for Agile Software Development
cspag67
 
Intro Agile Software Development with Scrum for Campus Party 2009
Antonio Silveira
 
Lecture#08 sequence diagrams
babak danyal
 
Software Engineering: Models
David Millard
 
Sequence diagrams in UML
Paxcel Technologies
 
Class, Collaboration, Sequence Diagram of a sample project
Naimul Arif
 
INTRODUCTION TO UML DIAGRAMS
Ashita Agrawal
 
System Models in Software Engineering SE7
koolkampus
 
High Quality Software Development with Agile and Scrum
Lemi Orhan Ergin
 
Ch5- Software Engineering 9
Ian Sommerville
 
UML diagrams and symbols
Kumar
 
OOAD UNIT I UML DIAGRAMS
Mikel Raj
 
Modeling objects interaction via UML sequence diagrams [Software Modeling] [...
Ivano Malavolta
 
Overview of Agile Methodology
Haresh Karkar
 
Ad

Similar to 08 class and sequence diagrams (20)

PPT
Uml - An Overview
Raj Thilak S
 
PPT
UML-class_diagram.ppt diagrams ppt download
divijareddy0502
 
PPT
UML-class diagram for beginners to adance.ppt
WorkDrive2
 
PPT
cse 355 UML class diagram software engineering.ppt
Safaet Hossain
 
PPT
UML-class_diagram.ppt
PragnyaNandaSabat
 
PPT
uml2-1214558329929112-8.ppt
AleksandarUrdarevski
 
PPTX
Lecture 06.pptxLecture 06.pptxLecture 06.pptx
EnghamzaKhalailah
 
PPT
UML Introduction The system development life cycle (SDLC) is a complex projec...
ssuserdb9909
 
PPSX
DISE - OOAD Using UML
Rasan Samarasinghe
 
PPTX
Unified Modeling Language and Examples .pptx
abinaya707644
 
PPT
Uml report
Franco Valdez
 
PPT
uml.ppt
RojaPogul1
 
PPTX
Cs 1023 lec 10 uml (week 3)
stanbridge
 
PDF
Introduction to UML, a guide to learn.pdf
TARGARYEN001
 
PPT
graph
Dipa Mokashi
 
PPT
umlpresentation-140519151641-phpapp02.ppt
FootballToday3
 
PPT
Uml &amp; rup
◄ vaquar khan ► ★✔
 
PPT
SDA ClassDiagram.ppt
AteeqaKokab1
 
PPT
Uml class-diagram
ASHOK KUMAR PALAKI
 
PPT
Chapter 2-Unified Modeling Languagee.ppt
SisayNegash4
 
Uml - An Overview
Raj Thilak S
 
UML-class_diagram.ppt diagrams ppt download
divijareddy0502
 
UML-class diagram for beginners to adance.ppt
WorkDrive2
 
cse 355 UML class diagram software engineering.ppt
Safaet Hossain
 
UML-class_diagram.ppt
PragnyaNandaSabat
 
uml2-1214558329929112-8.ppt
AleksandarUrdarevski
 
Lecture 06.pptxLecture 06.pptxLecture 06.pptx
EnghamzaKhalailah
 
UML Introduction The system development life cycle (SDLC) is a complex projec...
ssuserdb9909
 
DISE - OOAD Using UML
Rasan Samarasinghe
 
Unified Modeling Language and Examples .pptx
abinaya707644
 
Uml report
Franco Valdez
 
uml.ppt
RojaPogul1
 
Cs 1023 lec 10 uml (week 3)
stanbridge
 
Introduction to UML, a guide to learn.pdf
TARGARYEN001
 
umlpresentation-140519151641-phpapp02.ppt
FootballToday3
 
SDA ClassDiagram.ppt
AteeqaKokab1
 
Uml class-diagram
ASHOK KUMAR PALAKI
 
Chapter 2-Unified Modeling Languagee.ppt
SisayNegash4
 
Ad

More from kebsterz (10)

PPT
07 software design
kebsterz
 
PPT
07 software design
kebsterz
 
PPT
An overview about effort value points
kebsterz
 
PPT
An overview about effort value points
kebsterz
 
PPT
An overview about effort value points
kebsterz
 
PPT
An overview about effort value points
kebsterz
 
PPT
Pokémon competitive battling an introduction
kebsterz
 
PPT
Pokemon an introduction
kebsterz
 
PPTX
Pokémon competitive battling an introduction
kebsterz
 
PPTX
Pokemon an introduction
kebsterz
 
07 software design
kebsterz
 
07 software design
kebsterz
 
An overview about effort value points
kebsterz
 
An overview about effort value points
kebsterz
 
An overview about effort value points
kebsterz
 
An overview about effort value points
kebsterz
 
Pokémon competitive battling an introduction
kebsterz
 
Pokemon an introduction
kebsterz
 
Pokémon competitive battling an introduction
kebsterz
 
Pokemon an introduction
kebsterz
 

Recently uploaded (20)

PDF
Simplify Your FME Flow Setup: Fault-Tolerant Deployment Made Easy with Packer...
Safe Software
 
PDF
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
 
PDF
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
PPTX
Reimaginando la Ciberdefensa: De Copilots a Redes de Agentes
Cristian Garcia G.
 
PDF
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
PDF
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
PDF
Kubernetes - Architecture & Components.pdf
geethak285
 
PDF
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
PPTX
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
PDF
“A Re-imagination of Embedded Vision System Design,” a Presentation from Imag...
Edge AI and Vision Alliance
 
PDF
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
PDF
GDG Cloud Southlake #44: Eyal Bukchin: Tightening the Kubernetes Feedback Loo...
James Anderson
 
PDF
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
PDF
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
PPTX
Practical Applications of AI in Local Government
OnBoard
 
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
PDF
DoS Attack vs DDoS Attack_ The Silent Wars of the Internet.pdf
CyberPro Magazine
 
PPTX
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
 
PPTX
2025 HackRedCon Cyber Career Paths.pptx Scott Stanton
Scott Stanton
 
Simplify Your FME Flow Setup: Fault-Tolerant Deployment Made Easy with Packer...
Safe Software
 
Understanding The True Cost of DynamoDB Webinar
ScyllaDB
 
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
Reimaginando la Ciberdefensa: De Copilots a Redes de Agentes
Cristian Garcia G.
 
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
Kubernetes - Architecture & Components.pdf
geethak285
 
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Pitch ...
Michele Kryston
 
“A Re-imagination of Embedded Vision System Design,” a Presentation from Imag...
Edge AI and Vision Alliance
 
99 Bottles of Trust on the Wall — Operational Principles for Trust in Cyber C...
treyka
 
GDG Cloud Southlake #44: Eyal Bukchin: Tightening the Kubernetes Feedback Loo...
James Anderson
 
Enhancing Environmental Monitoring with Real-Time Data Integration: Leveragin...
Safe Software
 
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
Practical Applications of AI in Local Government
OnBoard
 
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
DoS Attack vs DDoS Attack_ The Silent Wars of the Internet.pdf
CyberPro Magazine
 
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
 
2025 HackRedCon Cyber Career Paths.pptx Scott Stanton
Scott Stanton
 

08 class and sequence diagrams

  • 1. INTROSE Introduction to Software Engineering Raymund Sison, PhD College of Computer Studies De La Salle University [email_address] Modeling Software Systems
  • 2. How do we model complex systems? Epistemology Knowledge about Causality (Dynamic Model) Describes our knowledge about the system Knowledge about Functionality (Functional model) Knowledge about Relationships (Object model) From (Bruegge & Dutoit, 2004) Neural Networks DataFlow Diagrams (SA/SD) Scenarios/Use Cases (Jacobsen) Formal Specifications (Liskov) Petri Nets(Petri) Inheritance Frames,SemanticNetworks (Minsky) Uncertain Knowledge Fuzzy Sets (Zadeh) Data Relationship (E/R Modeling, Chen) Hierarchical Database Model (IMS) Network Database Model (CODASYL) Relational Database Model (Codd) Fuzzy Frames (Graham) Class Diagrams (“E/R + Inheritance”, Rumbaugh) Sequence Diagrams (Lamport) Activity Diagrams (“good old Flowcharts”)
  • 3. How do we model complex systems? Epistemology Knowledge about Causality (Dynamic Model) Describes our knowledge about the system Knowledge about Functionality (Functional model) Knowledge about Relationships (Object model) From (Bruegge & Dutoit, 2004) Neural Networks DataFlow Diagrams (SA/SD) Scenarios/Use Cases (Jacobsen) Formal Specifications (Liskov) Petri Nets(Petri) Inheritance Frames,SemanticNetworks (Minsky) Uncertain Knowledge Fuzzy Sets (Zadeh) Data Relationship (E/R Modeling, Chen) Hierarchical Database Model (IMS) Network Database Model (CODASYL) Relational Database Model (Codd) Fuzzy Frames (Graham) Class Diagrams (“E/R + Inheritance”, Rumbaugh) Sequence Diagrams (Lamport) Activity Diagrams (“good old Flowcharts”)
  • 4. Components of an Object Model Classes Associations (Relations) Kind-of/Is-a (Generalization) Part-of/Has-a (Aggregation) Domain-specific associations Attributes Operations
  • 5. UML Classes A class is simply represented as a box with the name of the class inside The diagram may also show the attributes and operations The complete signature of an operation is: operationName(parameterName: parameterType …): returnType Class Diagram slides from (Lethbridge & Laganiere, 2005)
  • 6. Associations and Multiplicity An association is used to show how two classes are related to each other Symbols indicating multiplicity are shown at each end of the association
  • 7. Labelling Associations Each association can be labelled, to make explicit the nature of the association
  • 8. Analyzing and Validating Associations Many-to-one A company has many employees, An employee can only work for one company. This company will not store data about the moonlighting activities of employees! A company can have zero employees E.g. a ‘shell’ company It is not possible to be an employee unless you work for a company * worksFor Employee Company 1
  • 9. Analyzing and Validating Associations Many-to-many An assistant can work for many managers A manager can have many assistants Assistants can work in pools Managers can have a group of assistants Some managers might have zero assistants. Is it possible for an assistant to have, perhaps temporarily, zero managers? * supervisor * * * * * 1..* Assistant Manager
  • 10. Analyzing and Validating Associations One-to-one For each company, there is exactly one board of directors A board is the board of only one company A company must always have a board A board must always be of some company 1 1
  • 11. Analyzing and Validating Associations Avoid unnecessary one-to-one associations Avoid this Do this
  • 12. A More Complex Example A booking is always for exactly one passenger no booking with zero passengers a booking could never involve more than one passenger. A Passenger can have any number of Bookings a passenger could have no bookings at all a passenger could have more than one booking The frame around this diagram is an optional feature that any UML 2.0 may possess.
  • 13. Association Classes Sometimes, an attribute that concerns two associated classes cannot be placed in either of the classes The following are equivalent
  • 14. Reflexive Associations It is possible for an association to connect a class to itself
  • 15. Directionality in Associations Associations are by default bi-directional It is possible to limit the direction of an association by adding an arrow at one end
  • 16. Generalization Specializing a superclass into two or more subclasses A generalization set is a labeled group of generalizations with a common superclass The label (sometimes called the discriminator ) describes the criteria used in the specialization
  • 17. Avoiding Unnecessary Generalizations Inappropriate hierarchy of classes, which should be instances
  • 18. Avoiding Unnecessary Generalizations Improved class diagram, with its corresponding instance diagram
  • 19. Handling Multiple Discriminators Creating higher-level generalization
  • 20. Handling Multiple Discriminators Using multiple inheritance
  • 21. Object Diagrams A link is an instance of an association (in the same way that we say an object is an instance of a class)
  • 22. Associations vs. Generalizations in Object Diagrams Associations describe the relationships that will exist between instances at run time. When you show an instance diagram generated from a class diagram, there will be an instance of both classes joined by an association Generalizations describe relationships between classes in class diagrams. They do not appear in instance diagrams at all. An instance of any class should also be considered to be an instance of each of that class’s superclasses
  • 23. Aggregation Aggregations are special associations that represent ‘part-whole’ relationships. The ‘whole’ side is often called the assembly or the aggregate This symbol is a shorthand notation association named isPartOf
  • 24. When to Use an Aggregation As a general rule, you can mark an association as an aggregation if the following are true: You can state that the parts ‘are part of’ the aggregate or the aggregate ‘is composed of’ the parts When something owns or controls the aggregate, then they also own or control the parts
  • 25. Composition A composition is a strong kind of aggregation If the aggregate is destroyed, then the parts are destroyed as well Two alternatives for addresses
  • 27. Propagation A mechanism where an operation in an aggregate is implemented by having the aggregate perform that operation on its parts At the same time, properties of the parts are often propagated back to the aggregate Propagation is to aggregation as inheritance is to generalization. The major difference is: inheritance is an implicit mechanism propagation has to be programmed when required
  • 28. Interfaces An interface describes a portion of the visible behavior of a set of objects. An interface is similar to a class, except it lacks instance variables and implemented methods
  • 29. Notes and Descriptive Text Descriptive text and other diagrams Embed your diagrams in a larger document Text can explain aspects of the system using any notation you like Highlight and expand on important features, and give rationale Notes : A note is a small block of text embedded in a UML diagram It acts like a comment in a programming language
  • 30. How do we model complex systems? Epistemology Knowledge about Causality (Dynamic Model) Describes our knowledge about the system Knowledge about Functionality (Functional model) Knowledge about Relationships (Object model) From (Bruegge & Dutoit, 2004) Neural Networks DataFlow Diagrams (SA/SD) Scenarios/Use Cases (Jacobsen) Formal Specifications (Liskov) Petri Nets(Petri) Inheritance Frames,SemanticNetworks (Minsky) Uncertain Knowledge Fuzzy Sets (Zadeh) Data Relationship (E/R Modeling, Chen) Hierarchical Database Model (IMS) Network Database Model (CODASYL) Relational Database Model (Codd) Fuzzy Frames (Graham) Class Diagrams (“E/R + Inheritance”, Rumbaugh) Sequence Diagrams (Lamport) Activity Diagrams (“good old Flowcharts”)
  • 31. UML Interaction Diagrams Model the dynamic aspects of the system by showing relationships among objects and the messages they may dispatch Capture the behavior of a single use case Show a number of example objects and the messages that are passed between these objects within the use case
  • 32. UML Interaction Diagrams Sequence Diagram Emphasizes the time ordering of messages Focuses on the chronological course of the messages Collaboration Diagram Emphasizes the organization of the objects that participate in an interaction Focuses on the cooperation among objects
  • 33. UML Collaboration Diagram Shows a set of interactions between selected objects in a specific, limited situation, focusing on the relations between the objects and their topology The chronological course of communication with each other is marked by numbering the messages Shows the chronological sequences of the messages, their names and responses, and their possible arguments One collaboration diagram for each use case
  • 34. Link Links between objects are like associations in the class model Enables objects to send messages There should be an association in the class model between the two link objects Links may be instances of associations that are shown in the class diagram
  • 35. Message Links may be labeled with the names of messages A communication between two objects that conveys information with the expectation that action will ensue An event sent from one object to another An operation being invoked on another object Creation or destruction of an object instance
  • 36. Collaboration Diagram Show objects and links Superimpose messages on links a : Assembly part : CatalogEntry 1.1: number = getNumber() 1 : count(part) : Client
  • 37. Collaboration Diagram course_form : CourseForm theManager : CurriculumManager aCourse : Course 4 : <<create>> 3 : add_course() 1 : set_course_info() 2 : process_form() : Registrar
  • 38. Message Sequence Sequence of messages are determined by numbering Defines the order in which the interaction takes place 1, 2, 3, 4, ….. 1, 1.1, 1.2, 1.3, 2, 2.1, 2.1.1, 2.2, 3 (shows which operation calls which other operation)
  • 39. Sequence Diagram Used to show the same interaction in a collaboration diagram but emphasize the order of the messages over time Object instances are arranged horizontally across the page Time runs vertically down the page Messages flow from left to right or from right to left
  • 40. Sequence Diagram Time Objects and Message Flows
  • 41. Lifeline Objects are displayed at the top of the diagram The vertical dimension represents time Each object has a dashed line – lifeline – extending below it – to indicate the period of time during which objects playing that role actually exist Object Name
  • 42. Message The messages in an interaction are drawn from top to bottom , in the order that they are sent. Messages are shown as arrows pointing from the lifeline of the role sending the message to the lifeline of the receiver. When a message is sent , control passes from the sender of the message to the receiver. Object Name Object Name message
  • 43. Return Return of control is shown using dashed arrow returning to the calling object. Object Name Object Name message
  • 44. Activation Period of time during which an object is processing a message Shown on a lifeline as a narrow rectangle whose top is connected to a message When an object finishes processing a message, control returns to the sender of the message
  • 45. Sequence Diagram a : Assembly part : CatalogEntry getNumber() count(part) return number Lifeline Activation(optional) Messages control returns to the sender of the message (optional) : Client
  • 46. Hierarchical Numbering of Messages 1.1 1 1.2 2 2.1 2.2 2.2.1 2.1.1 2.1.2
  • 47. Object Creation course_form : CourseForm theManager : CurriculumManager aCourse : Course set_course_info process_form add_course <<create>> Object creation : Registrar
  • 48. Object Creation: Order Entry Example Order OrderLine quantity: integer cost: float CatalogEntry 1 * 1 * : Client : Order : CatalogEntry OrderLine(qty,part) add(qty,part) : OrderLine getCost() return cost Object creation
  • 49. Object Destruction: Order Entry Example : Order <<destroy>> remove(line) : OrderLine X : Client Object deletion
  • 50. Recurrence When a sequence of messages takes place within an iteration , messages are grouped together within a rectangle Object Name Object Name Object Name message message *[recurrence condition]
  • 51. Branching Shown by 2 arrows branching off from the same point Condition-clause is added to the message to show the condition Object Name Object Name Object Name [condition] message [condition] message
  • 52. Conditional Message Messages which are sent only under certain circumstances Not used in most cases because of the complexity of the resulting diagrams Consists of a Boolean expression written in square brackets
  • 53. Conditional Message: Sequence Diagram : Order : CatalogEntry [s>=qty] OrderLine(qty,part) add(qty,part) : OrderLine getCost() return cost getStockLevel(part) return s : Client
  • 54. Conditional Message: Communication Diagram : Order : OrderLine {new} : CatalogEntry 1: add(qty, part) 1.2: [s>=qty] OrderLine(qty, part) 1.2.1: cost = getCost() {new} {new} 1.1: s = getStockLevel(part) : Client
  • 55. Message to Self A message that an object sends to itself gives rise to a new activation The new activation takes place in an object that already has a live activation The recursive nature of this new activation is shown by superimposing the new activation on top of the original one
  • 56. Self-Delegation: Sequence Diagram : Order : Customer getShippingCost() getTotal() : OrderLine * getLocation() * getValue() : Client
  • 57. Self-Delegation: Collaboration Diagram : Order : Customer : OrderLine * 1: getTotal() 1.2.1: getLocation() 1.1 * : getValue() 1.2: getShippingCost() <<self>> : Client