05 ch5 (system modeling) - cse.hcmut.edu.vnhiep/cnpm/cnpmbktphcm/ch5 - system modeling.p… ·...

39
1/20/2015 1 SOFTWARE ENGINEERING Chapter 5 – System Modelling Topics covered Context models Interaction models Structural models Behavioral models Model-driven engineering Jul 2013 Chapter 5. System modeling 2

Upload: others

Post on 18-Oct-2019

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

1

SOFTWARE ENGINEERINGChapter 5 – System Modelling

Topics covered• Context models• Interaction models• Structural models• Behavioral models• Model-driven engineering

Jul 2013 Chapter 5. System modeling 2

Page 2: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

2

System modeling• the process of developing abstract models of a system,

with each model presenting a different view or perspective of that system.

• representing a system using some kind of graphical notation, which is now almost always based on notations in the Unified Modeling Language (UML).

• helps the analyst to understand the functionality of the system and models are used to communicate with customers.

Jul 2013 Chapter 5. System modeling 3

Existing and planned system models• Models of the existing system

• are used during requirements engineering• to help clarify what the existing system does and can be used as a

basis for discussing its strengths and weaknesses• then lead to requirements for the new system.

• Models of the new system • are used during requirements engineering • to help explain the proposed requirements to other system

stakeholders• Engineers use these models to discuss design proposals and to

document the system for implementation.

Jul 2013 Chapter 5. System modeling 4

Page 3: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

3

System perspectives• An external perspective

• model the context or environment of the system.

• An interaction perspective• model the interactions between a system and its environment, or

between the components of a system.

• A structural perspective• model the organization of a system or the structure of the data that

is processed by the system.

• A behavioral perspective• model the dynamic behavior of the system and how it responds to

events.

Jul 2013 Chapter 5. System modeling 5

UML diagram types• Activity diagrams

• show the activities involved in a process or in data processing .

• Use case diagrams• show the interactions between a system and its environment.

• Sequence diagrams• show interactions between actors and the system and between

system components.

• Class diagrams• show the object classes in the system and the associations

between these classes.

• State diagrams• show how the system reacts to internal and external events.

Jul 2013 Chapter 5. System modeling 6

Page 4: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

4

Use of graphical models• As a means of facilitating discussion about an existing or

proposed system• Incomplete and incorrect models are OK as their role is to support

discussion.

• As a way of documenting an existing system• Models should be an accurate representation of the system but

need not be complete.

• As a detailed system description that can be used to generate a system implementation• Models have to be both correct and complete.

Jul 2013 Chapter 5. System modeling 7

Context models• Illustrate the operational context of a system

• show what lies outside the system boundaries

• Social and organisational concerns may affect the decision on where to position system boundaries

• Architectural models show the system and its relationship with other systems.

Jul 2013 Chapter 5. System modeling 8

Page 5: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

5

System boundaries• System boundaries are established to define what is

inside and what is outside the system.• They show other systems that are used or depend on the system

being developed.

• The position of the system boundary has a profound effect on the system requirements.

• Defining a system boundary is a political judgment• There may be pressures to develop system boundaries that

increase / decrease the influence or workload of different parts of an organization.

Jul 2013 Chapter 5. System modeling 9

The context of the MHC-PMS

Jul 2013 Chapter 5. System modeling 10

Page 6: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

6

Movies for Rent

Jul 2013 Chapter 5. System modeling 11

• A system that allows customers to search movies, rent/return them and buy them off

• Movies could be in DVD, VCD, Blue ray, etc.• Customers are grouped into classes (e.g., VIP, normal,

new customers)• Rates (for rent) and (selling) prices are determined based

on customers’ membership and, of course, the movie in question

• The system connects to a separate client management unit to for authentication and manage customers’ info

Movies for Rent: System boundary

Jul 2013 Chapter 5. System modeling 12

Page 7: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

7

Process perspective• Context models simply show the other systems in the

environment, not how the system being developed is used in that environment.

• Process models reveal how the system being developed is used in broader business processes.

• UML activity diagrams may be used to define business process models.

Jul 2013 Chapter 5. System modeling 13

Process model of involuntary detention

Jul 2013 Chapter 5. System modeling 14

Page 8: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

8

Interaction models• Modeling user interaction is important as it helps to

identify user requirements. • Modeling system-to-system interaction highlights the

communication problems that may arise. • Modeling component interaction helps us understand if a

proposed system structure is likely to deliver the required system performance and dependability.

• Use case diagrams and sequence diagrams may be used for interaction modeling.

Jul 2013 Chapter 5. System modeling 15

Use case modeling• Use cases were developed originally to support

requirements elicitation and now incorporated into the UML.

• Each use case represents a discrete task that involves external interaction with a system.

• Actors in a use case may be people or other systems.• Represented diagramatically to provide an overview of the

use case and in a more detailed textual form.

Jul 2013 Chapter 5. System modeling 16

Page 9: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

9

Transfer-data use case• A use case in the MHC-PMS

Jul 2013 Chapter 5. System modeling 17

Tabular description of the ‘Transfer data’ use-case

Jul 2013 Chapter 5. System modeling 18

MHC-PMS: Transfer data

Actors Medical receptionist, patient records system (PRS)

Description A receptionist may transfer data from the MHC-PMS to ageneral patient record database that is maintained by ahealth authority. The information transferred may eitherbe updated personal information (address, phonenumber, etc.) or a summary of the patient’s diagnosisand treatment.

Data Patient’s personal information, treatment summary

Stimulus User command issued by medical receptionist

Response Confirmation that PRS has been updated

Comments The receptionist must have appropriate securitypermissions to access the patient information and thePRS.

Page 10: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

10

Use cases in the MHC-PMS involving the role ‘Medical Receptionist’

Jul 2013 Chapter 5. System modeling 19

Alternative Use-Case Scenarios• Scenario

• A single sequence of steps• No branching!!!

• Ex: Login use-case• Main scenario

1. User enters username and password2. User click “Login” button3. System validates the username and password are correct4. System change status of the user to “logged in”

• Alternative 14A. [Validating is not passed] System display an error message

• Alternative 22A. User click “Cancel” button

Jul 2013 Chapter 5. System modeling 20

Page 11: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

11

Alternative Use-Case Scenarios

Jul 2013 Chapter 5. System modeling 21

Use Case ID:Use Case

Name:Created By: Last Updated By:

Date Created: Date Last Updated:

Actors:Description:

Trigger:Preconditions: 1.

Postconditions: 1.Normal Flow: 1.

Alternative Flows:Exceptions:

Includes:Priority:

Frequency of Use:Business Rules:

Special Requirements:Assumptions:

Notes and Issues:

Alternative Use-Case Scenarios• Actor: A member of the public (MP)• Use case: The MP is searching for club events on a particular date.• Preconditions: The MP is at the CIS home page, but not logged in as

a member.• Scenario A:

• 1. MP selects “Search Events” on MP home page• 2. System presents a page with choice of dates for the current month• 3. MP selects a date from among the choices• 4. System presents a page with events for that date, giving time and club name• 5. MP selects an event• 6. System presents a page with details of that event, including location,

description and cost• Exception:

• 4. If there are no events for the selected date, System presents a page saying that there are no events for the selected date

• Alternative Scenario A1:• 3a. MP selects a different month• 3b. System presents a page with choice of dates for the current month

Jul 2013 Chapter 5. System modeling 22

Page 12: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

12

Advanced UML notations• Extend and Include

• Ex: Manage Users

• Assumption• Ex: Change User Name user-case

• Assumption: User is logged in1.User click “Change Name” menu item2.System display “Change Name” form3.User enters a new name4.User hits “Confirm” button5.System change the user name to the new name

Jul 2013 Chapter 5. System modeling 23

Browse the list of Users

Edit a User

Delete a User

<<extend>>

Login

<<include>>

Create a new User

<<extend>>

<<extend>>

Movies for Rent: a few use-cases • Actors: Client, Manager, Admin???

• Use-cases: Login, Searching-Browsing, Rent, Buy, Return, Create a New Client, Edit Client’s Info???

• Any relations between use-cases? <<include>>, <<extend>>???

Jul 2013 Chapter 5. System modeling 24

Page 13: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

13

Sequence diagrams• Sequence diagrams are part of the UML and are used to

model the interactions between the actors and the objects within a system.

• A sequence diagram shows the sequence of interactions that take place during a particular use case or use case instance.

• The objects and actors involved are listed along the top of the diagram, with a dotted line drawn vertically from these.

• Interactions between objects are indicated by annotated arrows.

Jul 2013 Chapter 5. System modeling 25

Sequence diagram for View patient information

Jul 2013 Chapter 5. System modeling 26

Page 14: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

14

Sequence diagram for Transfer Data

Jul 2013 Chapter 5. System modeling 27

Build a Sequence Diagram• 1. Identify the use case whose sequence diagram you will

build • 2. Identify which entity initiates the use case

• the user, or• an object of a class

• name the class• name the object

• 3. Draw a rectangle to represent this object at left top• use UML object:Class notation

• 4. Draw an elongated rectangle beneath this to represent the execution of an operation

• 5. Draw an arrow pointing right from it to indicate invoked functionality

Jul 2013 Chapter 5. System modeling 28

myObject:MyClass

Page 15: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

15

Build a Sequence Diagram

• 6. Identify which entity handles the operation initiated • an object of a class

• name the class• name the object

• 7. Label the arrow with the name of the operation• don’t show return?

• 8. Show a process beginning, using an elongated rectangle

• 9…… Continue with each new statement of the use case.

Jul 2013 Chapter 5. System modeling 29

MyObject:MyClass

MyObject1:MyClass1

My operation

Movies4Rent: A sequence diagram

Jul 2013 Chapter 5. System modeling 30

Page 16: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

16

Structural models• Structural models of software display the organization of a

system in terms of the components that make up that system and their relationships.

• Structural models may be static models, which show the structure of the system design, or dynamic models, which show the organization of the system when it is executing.

• You create structural models of a system when you are discussing and designing the system architecture.

Jul 2013 Chapter 5. System modeling 31

Class diagrams• Class diagrams are used when developing an object-

oriented system model to show the classes in a system and the associations between these classes.

• An object class can be thought of as a general definition of one kind of system object.

• An association is a link between classes that indicates that there is some relationship between these classes.

• When you are developing models during the early stages of the software engineering process, objects represent something in the real world, such as a patient, a prescription, doctor, etc.

Jul 2013 Chapter 5. System modeling 32

Page 17: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

17

UML classes and association

Jul 2013 Chapter 5. System modeling 33

Classes and associations in the MHC-PMS

Jul 2013 Chapter 5. System modeling 34

Page 18: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

18

The Consultation class

Jul 2013 Chapter 5. System modeling 35

Generalization• Generalization is an everyday technique that we use to

manage complexity. • Rather than learn the detailed characteristics of every

entity that we experience, we place these entities in more general classes (animals, cars, houses, etc.) and learn the characteristics of these classes.

• This allows us to infer that different members of these classes have some common characteristics e.g. squirrels and rats are rodents.

Jul 2013 Chapter 5. System modeling 36

Page 19: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

19

Generalization• In modeling systems, it is often useful to examine the

classes in a system to see if there is scope for generalization. If changes are proposed, then you do not have to look at all classes in the system to see if they are affected by the change.

• In object-oriented languages, such as Java, generalization is implemented using the class inheritance mechanisms built into the language.

• In a generalization, the attributes and operations associated with higher-level classes are also associated with the lower-level classes.

• The lower-level classes are subclasses inherit the attributes and operations from their superclasses. These lower-level classes then add more specific attributes and

Jul 2013 Chapter 5. System modeling 37

A generalization hierarchy

Jul 2013 Chapter 5. System modeling 38

Page 20: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

20

A generalization hierarchy with added detail

Jul 2013 Chapter 5. System modeling 39

Object class aggregation models• An aggregation model shows how classes that are

collections are composed of other classes.• Aggregation models are similar to the part-of relationship

in semantic data models.

Jul 2013 Chapter 5. System modeling 40

Page 21: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

21

The aggregation association

Jul 2013 Chapter 5. System modeling 41

Behavioral models• Behavioral models are models of the dynamic behavior of

a system as it is executing. They show what happens or what is supposed to happen when a system responds to a stimulus from its environment.

• You can think of these stimuli as being of two types:• Data: Some data arrives that has to be processed by the system.• Events: Some event happens that triggers system processing.

Events may have associated data, although this is not always the case.

Jul 2013 Chapter 5. System modeling 42

Page 22: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

22

Data-driven modeling• Many business systems are data-processing systems that

are primarily driven by data. They are controlled by the data input to the system, with relatively little external event processing.

• Data-driven models show the sequence of actions involved in processing input data and generating an associated output.

• They are particularly useful during the analysis of requirements as they can be used to show end-to-end processing in a system.

Jul 2013 Chapter 5. System modeling 43

An activity model of the insulin pump’s operation

Jul 2013 Chapter 5. System modeling 44

Page 23: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

23

Order processing

Jul 2013 Chapter 5. System modeling 45

Event-driven modeling• Real-time systems are often event-driven, with minimal

data processing. For example, a landline phone switching system responds to events such as ‘receiver off hook’ bygenerating a dial tone.

• Event-driven modeling shows how a system responds to external and internal events.

• It is based on the assumption that a system has a finite number of states and that events (stimuli) may cause a transition from one state to another.

Jul 2013 Chapter 5. System modeling 46

Page 24: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

24

State machine models• These model the behaviour of the system in response to

external and internal events.• They show the system’s responses to stimuli so are often

used for modelling real-time systems.• State machine models show system states as nodes and

events as arcs between these nodes. When an event occurs, the system moves from one state to another.

• Statecharts are an integral part of the UML and are used to represent state machine models.

Jul 2013 Chapter 5. System modeling 47

State diagram of a microwave oven

Jul 2013 Chapter 5. System modeling 48

Page 25: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

25

States and stimuli for the microwave oven (a)

Jul 2013 Chapter 5. System modeling 49

State DescriptionWaiting The oven is waiting for input. The display shows the current time.

Half power The oven power is set to 300 watts. The display shows ‘Half power’.

Full power The oven power is set to 600 watts. The display shows ‘Full power’.

Set time The cooking time is set to the user’s input value. The display showsthe cooking time selected and is updated as the time is set.

Disabled Oven operation is disabled for safety. Interior oven light is on.Display shows ‘Not ready’.

Enabled Oven operation is enabled. Interior oven light is off. Display shows‘Ready to cook’.

Operation Oven in operation. Interior oven light is on. Display shows the timercountdown. On completion of cooking, the buzzer is sounded for fiveseconds. Oven light is on. Display shows ‘Cooking complete’ whilebuzzer is sounding.

States and stimuli for the microwave oven (b)

Jul 2013 Chapter 5. System modeling 50

Stimulus DescriptionHalf power The user has pressed the half-power button.

Full power The user has pressed the full-power button.

Timer The user has pressed one of the timer buttons.

Number The user has pressed a numeric key.

Door open The oven door switch is not closed.

Door closed The oven door switch is closed.

Start The user has pressed the Start button.

Cancel The user has pressed the Cancel button.

Page 26: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

26

Microwave oven operation

Jul 2013 Chapter 5. System modeling 51

Model-driven engineering• Model-driven engineering (MDE) is an approach to

software development where models rather than programs are the principal outputs of the development process.

• The programs that execute on a hardware/software platform are then generated automatically from the models.

• Proponents of MDE argue that this raises the level of abstraction in software engineering so that engineers no longer have to be concerned with programming language details or the specifics of execution platforms.

Jul 2013 Chapter 5. System modeling 52

Page 27: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

27

Usage of model-driven engineering• Model-driven engineering is still at an early stage of

development, and it is unclear whether or not it will have a significant effect on software engineering practice.

• Pros• Allows systems to be considered at higher levels of abstraction• Generating code automatically means that it is cheaper to adapt

systems to new platforms.

• Cons• Models for abstraction and not necessarily right for implementation.• Savings from generating code may be outweighed by the costs of

developing translators for new platforms.

Jul 2013 Chapter 5. System modeling 53

Model driven architecture• Model-driven architecture (MDA) was the precursor of

more general model-driven engineering• MDA is a model-focused approach to software design and

implementation that uses a subset of UML models to describe a system.

• Models at different levels of abstraction are created. From a high-level, platform independent model, it is possible, in principle, to generate a working program without manual intervention.

Jul 2013 Chapter 5. System modeling 54

Page 28: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

28

Types of model• A computation independent model (CIM)

• These model the important domain abstractions used in a system. CIMs are sometimes called domain models.

• A platform independent model (PIM) • These model the operation of the system without reference to its

implementation. The PIM is usually described using UML models that show the static system structure and how it responds to external and internal events.

• Platform specific models (PSM) • These are transformations of the platform-independent model with

a separate PSM for each application platform. In principle, there may be layers of PSM, with each layer adding some platform-specific detail.

Jul 2013 Chapter 5. System modeling 55

MDA transformations

Jul 2013 Chapter 5. System modeling 56

Page 29: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

29

Multiple platform-specific models

Jul 2013 Chapter 5. System modeling 57

Summary• A model is an abstract view of a system that ignores system

details. Complementary system models can be developed to show the system’s context, interactions, structure and behavior.

• Context models show how a system that is being modeled is positioned in an environment with other systems and processes.

• Use case diagrams and sequence diagrams are used to describe the interactions between users and systems in the system being designed. Use cases describe interactions between a system and external actors; sequence diagrams add more information to these by showing interactions between system objects.

• Structural models show the organization and architecture of a system. Class diagrams are used to define the static structure of classes in a system and their associations.

Jul 2013 Chapter 5. System modeling 58

Page 30: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

30

Summary (cont.)• Behavioral models are used to describe the dynamic

behavior of an executing system. This behavior can be modeled from the perspective of the data processed by the system, or by the events that stimulate responses from a system.

• Activity diagrams may be used to model the processing of data, where each activity represents one process step.

• State diagrams are used to model a system’s behavior in response to internal or external events.

• Model-driven engineering is an approach to software development in which a system is represented as a set of models that can be automatically transformed to executable code.

Jul 2013 Chapter 5. System modeling 59

More• Read [2] for all other diagrams in UML

Jul 2013 Chapter 5. System modeling 60

Page 31: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

31

Collaboration diagrams – Example• Collaboration diagram for use-case Login

Jul 2013 Chapter 5. System modeling 61

: People

: LoginForm

: Database

1: login(uname,pswd)

1.2 [succ = true]: welcome

1.1: succ := Verify(uname,pswd)

Collaboration diagrams – Example 2• Collaboration diagram for use-case Registers course

Jul 2013 Chapter 5. System modeling 62

regForm : RegisterForm

: Student

: Database: Registration

3.1: reg := FetchReg(crsOffering)

3.3: SetReg(reg)3.2: AddStudent(code)

: LoginForm1: submit(uname, psswd)

1.1: succ := verify(uname, psswd)

1.2 [succ = true]: welcome

3: submit(crsOffering)

3.4: beSuccessful 2.1: create

2: register

Page 32: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

32

Collaboration diagrams vs. Sequence diagrams- Example 1• Sequence diagram for use-case Login

Jul 2013 Chapter 5. System modeling 63

: Database: People : LoginForm

1: submit(uname, psswd) 1.1: verify(uname, psswd)

1.2: welcome

Collaboration diagrams vs. Sequence diagrams- Example 1

• Sequence diagram for use-case Register courses

Jul 2013 Chapter 5. System modeling 64

: StudentregForm :

RegisterForm: Database: Registration: LoginForm

1: submit(uname, psswd) 1.1: verify(uname, psswd)1.2: welcome

2: register2.1: create

3. submit(crsOffering) 3.1: reg := fetchReg(srcOffering)

3.2: addStudent(code)

3.3: setReg(reg)

3.4: beSuccessful( )

Page 33: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

33

Activity diagrams• An activity diagram is a special kind of a statechart

diagram that shows the flow from activity to activity within a system.

• Activity diagrams address the dynamic view of a system. They are especially important in modeling the function of a system and emphasize the flow of control among objects.

• Focuses on activities

Jul 2013 Chapter 5. System modeling 65

Activ

ity d

iagr

ams

Jul 2013 Chapter 5. System modeling 66

Page 34: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

34

Activity diagrams

• Decisions: A decision involves selecting one control-flow transition out of many control-flow transitions based upon a condition

Jul 2013 Chapter 5. System modeling 67

Activity diagrams

• Concurrency: Concurrency involves selecting multiple transitions simultaneously. For example, while the printer is printing a report, the printer must also monitor for other incoming print requests.

Jul 2013 Chapter 5. System modeling 68

Page 35: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

35

Activity diagrams – Example• Activity diagram for submitting action in LoginForm

Jul 2013 Chapter 5. System modeling 69

Show input for username and password

Reject

[ psswd invalid ]

Welcome

[ psswd valid ]

Verify

DatabaseLoginForm

swimlane

Activity diagrams – Example 2• Activity diagram for submitting in RegisterForm

Jul 2013 Chapter 5. System modeling 70

Read course offerings

submit

Show success

Look for registration

Fetch registration

Create registration

Update registration

Add student

[ reg found ][ reg not found ]

RegistrationDatabaseRegForm

Page 36: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

36

RBAC system - revisited• - (RQ1) An employee plays 1 or more role(s) according to

her/his job• - (RQ2) System can access the company’s centralized

database• - (RQ3) System to determine whether an employee is allowed

to enter a particular room/hall• - (RQ4) System can control door locking devices• - (RQ5) System to allow 2-3 administrators to edit the access

rights of all employees using Web with good user-interface. • - (RQ6) System could report arriving/leaving time of an

employee each day• - (RQ7) System will get a signal if locking devices are tempered

with. It may then alert people responsible.

Jul 2013 Chapter 2. Software Processes 71

RBAC system – Use-case diagram• Check-list:

• a) More than 2 actors

• b) Admin must be authenticated to be able to do edit access rights

• c) <<include>>, <<extend>> for use-cases the admin interacts with. And they are semantically correct!

Jul 2013 Chapter 5. System modeling 72

Page 37: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

37

RBAC system – A sequence diagram• Sequence diagram for “entering a room”

Jul 2013 Chapter 5. System modeling 73

RBAC system – A sequence diagram• Checklist:

• a) Is the scenario represented by the sequence diagram complete?

• b) Have all parameters been represented?

• c) Arrival/Leaving time updated?

• d) Objects instead of Classes. Actor to the leftmost of your diagram

Jul 2013 Chapter 5. System modeling 74

Page 38: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

38

RBAC system – Class diagram

Jul 2013 Chapter 5. System modeling 75

RBAC system – Class diagram • Checklist

• a) Employee T.V.An, male, born 12/04/1981, employed as of 01/04/2012, is allowed to enter hall Seagulf and room C201. He entered that hall three times this week. Three other employees are also allowed to enter this hall.

• b) Has generalization?• c) Consistency with the use-case diagram and the sequence

diagram

Jul 2013 Chapter 5. System modeling 76

Page 39: 05 Ch5 (System Modeling) - cse.hcmut.edu.vnhiep/CNPM/CNPMBKTPHCM/Ch5 - System Modeling.p… · system in terms of the components that make up that system and their relationships

1/20/2015

39

Jul 2013 Chapter 5. System modeling 77