Top Banner
Chapter 6 – System Design II: Behavioral Models
31

Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Dec 30, 2015

Download

Documents

Eric McDowell
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Chapter 6 – System Design II: Behavioral Models

Page 2: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

6.1 Models

Models - what do you think of?

2

Page 3: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

A model behaves like (some part of) the intendedsystem, but in a more convenient way.

A good model should be • Abstract• Unambiguous• Allow for innovation• Standardized• Facilitate good communication• Modifiable• Remove unnecessary details & show important features• Break system into sub-problems.• Substitute sequence of actions by a single action.• Assist in verification• Assist in validation

3

Page 4: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.
Page 5: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Design for Electrical and Computer Engineers (Published by McGraw Hill)Not to be transmitted or reproduced without written consent of authors

Copyright 2005 Ralph M. Ford and Chris Coulston

5

Page 6: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

6.2 State DiagramsExample: Vending Machine

$0.05

$0.10

$0.15

$0.20

Initial/Reset:$0.00

dime

nickel

nickel

nickel

nickel

nickel

>= $0.25

dime

dime

dime

dime

Steady Discrete“States”

Start Here(also a state)

Transitions

Inputs thatCausetransitionsWhere are the

outputs?

Just names of states. Should not have confused the issue

Page 7: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

We’ll try doing it properly.

7

$0.05

$0.10

$0.15

$0.20

Initial/Reset:$0.00

dime

nickel

nickel

nickel

nickel

nickel

>= $0.25

dime

dime

dime

dime

Moore MachineOutputs on transitions

Mealy MachineOutputs for states

$0.00

Page 8: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Design for Electrical and Computer Engineers (Published by McGraw Hill)Not to be transmitted or reproduced without written consent of authors

Copyright 2005 Ralph M. Ford and Chris Coulston

8

Does not have to be graphical

Refined to a science withlots of theory

A lot like a programminglanguage.

Page 9: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Flowcharts

Symbols:

9

TerminatorGeneralProcess

ElaboratedProcess

GeneralData

DisplayedData

Stored Data Direct Data

Decision

Page 10: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Example: Light Monitoring System

• Can you figure out the operation of the system by looking at this?

• That is why the flowchart is elegant and not so lowly. Hah!

10

Samplelight

strengthStart

Computelight

sampleaverage

Store samplevalue inarray

Displayaveragevalue

Key-press?

Wait 1ms End

no

yes

Page 11: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Design for Electrical and Computer Engineers (Published by McGraw Hill)Not to be transmitted or reproduced without written consent of authors

Copyright 2005 Ralph M. Ford and Chris Coulston

11

Page 12: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

6.4 Data Flow Diagrams

Intention is ???

• DFDs can have levels, just like the functional

12

Process InterfaceData StoreData Flow

Page 13: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Example: Video Browsing System

13

VideoDatabase

ShotBoundaryDetection

AnnotationDatabase

Video

BoundariesKey

Frames

User

BrowseRequest

StoryboardPreview

Storyboard

KeyFrames

Boundaries

Shot Preview

Shot PreviewRequest

Video

Shot

Page 14: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

The Event Table

Event Trigger Process Source

Annotate Video

New Video Arrival

Shot Boundary Detection

System

View Storyboard

Browse Request

Storyboard Preview

User

View Shot Shot Preview Request

Shot Preview

User

14

VideoDatabase

ShotBoundaryDetection

AnnotationDatabase

Video

BoundariesKey

Frames

User

BrowseRequest

StoryboardPreview

Storyboard

KeyFrames

Boundaries

Shot Preview

Shot PreviewRequest

Video

Shot

Page 15: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

6.5 Entity Relationship Diagrams

• Intention of an ERD is

• Entities =

• Relationships =

• Attributes =

15

Page 16: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Example: College Database System

To

From

Student Course Department

Student takes: one to many

major: 1 to ≥1

Course has:one to many

pre-req for: one to anyrequires: one to any

offered by: one to one

Department

has majors: one to many

offers: one to many

Design for Electrical and Computer Engineers (Published by McGraw Hill)Not to be transmitted or reproduced without written consent of authors

Copyright 2005 Ralph M. Ford and Chris Coulston

16

Page 17: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

College Database ERD

17

Student SSN Name Date of birth Age GPA Major

Department Name Chair # of students

Course Number Department Credits Instructor Available Seats

takes /has

offers /offered by

majors in/enrolls

requires /is prereq

M

M

M1

M

M

M

1

Page 18: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Try Again

18

Student SSN Name Date of birth Age GPA Major

Department Name Chair # of students

Course Number Department Credits Instructor Available Seats

takes /has

offers /offered by

majors in/enrolls

requires /is prereq

M

M

M1

M

M

M

1

Page 19: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

UML - Scenario

• Pretty popular idea – web ordering of groceries followed by home delivery.

• The “v-Grocer” system.• User has a barcode scanner connected to home

computer.• They can scan a used item an automatically order it

from the grocery store.• Place the order and groceries delivered at pre-

arranged time.

19

Page 20: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Static View

• Object view of software.• Classes represent

• Data• Methods (functions) that operate on the data

• Objects are

• Can allow for different security levels.

20

+ChangeAddr() : bool

-Name : string-Address : string-CustId : long

Customer

Page 21: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Class Diagram

Design for Electrical and Computer Engineers (Published by McGraw Hill)Not to be transmitted or reproduced without written consent of authors

Copyright 2005 Ralph M. Ford and Chris Coulston

21

+ChangeAddr() : bool

-Name : string-Address : string-CustId : long

Customer

+ChangePrice()

-UPC : string-Cost : decimal-Type : string

Item

+TotalCost() : float

-OrderID : long-CustId : long

Order

+AddItem()

-UPC-OrderID-Quantity

GroceryCart

*

-contains

*

-part of

-Time : string-OrderId : long-CustID : long

Delivery-receives

*

-sent to

1

-sent by1

-contains1

Page 22: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Design for Electrical and Computer Engineers (Published by McGraw Hill)Not to be transmitted or reproduced without written consent of authors

Copyright 2005 Ralph M. Ford and Chris Coulston

22

Page 23: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Use-Case View

• Intention = • Characterized by a Use-Case Diagram

23

Customer

v-Grocer

WebOrder

WebServer

Database

Delivery

Clerk

AssembleOrder

DeliverOrder

Who’s involved in which activities

“Use-Case”= activityor procedure

Actors or Agents

Page 24: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Use-Case Description

Use-Case WebOrder

Actors Customer, Database, and WebServer

Description This use-case occurs when a customer submits an order via the WebServer. If it is a new customer, the WebServer prompts them to establish an account and their customer information is stored in the Database as a new entry. If they are an existing customer, they have the opportunity to update their personal information.

Stimulus Customer order via the GroceryCart.

Response Verify payment, availability of order items, and if successful trigger the AssembleOrder use-case.

24

Page 25: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

State Machine View

25

Present login

Read password

Query server

loaded

! enter

enter

! response

Order page

recognized

! recognized

! loaded

Page 26: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Activity View• Intention = describe a sequence of activities needed to complete a

task.

26

Complete order

Post to clerk

Post todelivery

Assemble order

Incorporate intoschedule

Send items

Determinedelivery route

Collectorders

Run delivery

This is really just a Petri Net used very badly.

Look up “Petri Net”.

Page 27: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Interaction View

• Intention = to show interaction between objects (when they must cooperate to do something useful).

• Use either a collaboration or sequence diagram.• This example is for the WebOrder use-case.

27

Page 28: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Design for Electrical and Computer Engineers (Published by McGraw Hill)Not to be transmitted or reproduced without written consent of authors

Copyright 2005 Ralph M. Ford and Chris Coulston

28

Page 29: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Design for Electrical and Computer Engineers (Published by McGraw Hill)Not to be transmitted or reproduced without written consent of authors

Copyright 2005 Ralph M. Ford and Chris Coulston

29

Page 30: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

Physical View• Show the physical components that constitute the

system.• Can think of this much more generally than

presentation in UML.

30

Page 31: Chapter 6 – System Design II: Behavioral Models. 6.1 Models Models - what do you think of? 2.

6.8 Summary

• Models are an abstraction of system.• Models can be thought of as a design specification.• Models have different intentions for describing

behavior.• Models should encourage innovation and provide

for clear documentation.

31