functional modeling 081 0. question how do you know if you have enough information to compute the...

32
Functional Modeling 081 081 0

Upload: john-cummings

Post on 12-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Functional Modeling

08108100

Page 2: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Question How do you know if you have enough information to compute How do you know if you have enough information to compute

the necessary output values?the necessary output values?

Page 3: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Functional Models What is a function?What is a function?

Page 4: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Steps in constructing Functional Model Identify data (e.g. input and output values)Identify data (e.g. input and output values) Identify transformations (e.g., functions)Identify transformations (e.g., functions) Identify sources and sinks for dataIdentify sources and sinks for data Draw DiagramDraw Diagram Identify the constraints.Identify the constraints.

Page 5: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Data Flow Diagrams:http://www.yourdon.com/strucanalysis/wiki/index.php?title=Chapter_9

Four things in diagramsFour things in diagrams Processes Processes (ellipses)(ellipses) Data flows Data flows (arrows)(arrows) Actors Actors (boxes)(boxes) Data stores Data stores (“open boxes”, parallel (“open boxes”, parallel

lines)lines)Data store

Page 6: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Simple Example DFD

Compute Average

ComputeGrades

GradesNames

Output Grades

Exam Grades

exam average

Student Names

Grade Book

Exam Grades Grades

Page 7: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Processes

Transforms data valuesTransforms data values Drawn as ellipses with fixed number of in-Drawn as ellipses with fixed number of in-

arrows and out-arrowsarrows and out-arrows Example:Example:

Integerdivision

dividend

divisor

quotient

remainder

Page 8: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Levels of detail

Level 1: Shows system inputs, outputs, and Level 1: Shows system inputs, outputs, and processesprocesses

Level 2: Shows inputs, outputs, and processes Level 2: Shows inputs, outputs, and processes for some Level 1 processfor some Level 1 process

Level 3: Shows inputs, outputs, and processes Level 3: Shows inputs, outputs, and processes for some Level 2 processfor some Level 2 process

programinputs outputs

Page 9: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Data Flows

Connect processesConnect processes Represent intermediate dataRepresent intermediate data Values are not changed by data flowValues are not changed by data flow Arrow with name or type of dataArrow with name or type of data

integera

copysimple

address city

zip

Aggregationsplit

addresscity

zip

street

Aggregationjoin

Page 10: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Actors

Producers or consumers of dataProducers or consumers of data aka “terminators”, “source and sink”aka “terminators”, “source and sink” Drawn as rectangleDrawn as rectangle

Customer

Page 11: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Data Store

Stores data for later useStores data for later use Has exactly two operations:Has exactly two operations:

StoreStore RetrieveRetrieve

Not an actor: must have both store and retrieveNot an actor: must have both store and retrieve Drawn as Drawn as

Data store

Page 12: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Example

Periodic Table

Findweight

element

Atomicweight

Atomicweights

Initializetable

Atomicweights

Page 13: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Example

Price List

Findcost

Item name

Item name

Cost

Cost

Page 14: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Level 1

ProcessPayroll

EmployeeRecords

TimeCards

Paychecks

AccountingReport

Page 15: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Level 2: Payroll Process

CalculateWithholding

EmployeeRecords

TimeCards

Paychecks

AccountingReport

Formatpaycheck

Validate TimeCard

CalculateGrossPay

FormatAccounting

Emp. Info.

Formatted Acct. Inf.

Acct. Inf.

Paycheck Info

Gross Pay

Valid Timecard Info

Timecard Info.

Formatted Paycheck.

Page 16: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Level 2: Calculate Withholding

ComputeWithholdingRate

Emp. Info.

Acct. Inf.

Paycheck InfoGross Pay

ComputeNet

Rate

Page 17: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Notes:

Show all possible computation paths for values.Show all possible computation paths for values. Do not show what paths are executed in what Do not show what paths are executed in what

order (that’s the job of the dynamic model).order (that’s the job of the dynamic model). There may be many Level N+1 diagrams for each There may be many Level N+1 diagrams for each

Level N diagram. Level N+1 expands a single Level N diagram. Level N+1 expands a single node of a Level N diagram.node of a Level N diagram.

Page 18: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Things to check in DFDs

1.1. Is each requirements function represented Is each requirements function represented by a transform in the DFDs?by a transform in the DFDs?

2.2. Is each system input and output Is each system input and output represented in the DFDs?represented in the DFDs?

Page 19: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Things to check in DFDs (cont’d)

5.5. Are all labels of information flows in the Are all labels of information flows in the data dictionary?data dictionary?

6.6. Do all data dictionary entries appear in the Do all data dictionary entries appear in the DFDs?DFDs?

Page 20: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

UML Activity Diagrams

Capture Actions and their resultsCapture Actions and their results Similar to state diagramsSimilar to state diagrams

Actions and results show in terms of state Actions and results show in terms of state changeschanges

Transitions occur when actions are Transitions occur when actions are complete (no events)complete (no events)

Page 21: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Purposes of Activity Diagrams

Capture work (actions) to be performed Capture work (actions) to be performed when an operation executeswhen an operation executes

Capture the internal work in an objectCapture the internal work in an object Show how related actions can be performedShow how related actions can be performed Show how an instance of a use case can be Show how an instance of a use case can be

performed in terms of actions and objectsperformed in terms of actions and objects Show how a business works in terms of Show how a business works in terms of

actors, workflows, and objectsactors, workflows, and objects

Page 22: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Activity Diagrams

ActionsActions Something performed to produce a resultSomething performed to produce a result An operation may consist of a set of actionsAn operation may consist of a set of actions Drawn as rounded-edged rectanglesDrawn as rounded-edged rectangles

EdgesEdges Do not have events (except for first edge)Do not have events (except for first edge) May have guard conditions, send-clause, or May have guard conditions, send-clause, or

action expressionaction expression Usually have nothing (transition occurs when Usually have nothing (transition occurs when

action is complete)action is complete)

Page 23: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Activity Diagram Elements

Show “Printing”

inMessageBox

Create pdffile

Sendpdf

to printer

RemoveMessageBox

Customer.Print()

Page 24: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Activity Diagram Elements

Show “Printing”

inMessageBox

Create pdffile

RemoveMessageBox

Customer.Print()

^Printer.Print(file)

Page 25: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Activity Diagram Elements

Show “Printing”

inMessageBox

Create pdffile

RemoveMessageBox

Customer.Print()

^Printer.Print(file)

ShowDisk Full msg

[full]

[free space]

<<decisionInput>> disk status

1

1

Page 26: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Style Points

Each edge leaving a decision point should have a Each edge leaving a decision point should have a guardguard

Guards on edges leaving decision points must not Guards on edges leaving decision points must not overlap (deterministic)overlap (deterministic)

Guards on edges leaving decision points form a Guards on edges leaving decision points form a complete set (must be possible to leave the guard)complete set (must be possible to leave the guard) [otherwise] can be used as a fall through case[otherwise] can be used as a fall through case

Model guards only if they add valueModel guards only if they add value Simplify Guards (see following)Simplify Guards (see following)

Page 27: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Three examples of guards[account.balance >= withdraw.amount]

[account.balance < withdraw.amount]

[false]

[true]

<<decisionInput>>[account.balance >= withdraw.amount]

[false]

[true]SufficientBalance?

Page 28: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

More style points

Include start and end pointsInclude start and end points Question “black hole” (no output edge) and Question “black hole” (no output edge) and

“miracle” (no input edge) activities “miracle” (no input edge) activities Use connectors to avoid hard to follow edges, but Use connectors to avoid hard to follow edges, but

make sure they matchmake sure they match Use numbers on connectors Use numbers on connectors

Page 29: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Parallel Actions

Initiate

MeasureUpdate Display

Page 30: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Using Objects to Represent Datastore

Initiate

MeasureUpdate Display

Measured value

Page 31: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Specifying Operations in Greater Detail Need a signatureNeed a signature

NameName Arguments (number, order, types)Arguments (number, order, types) Values returned (number, order, types)Values returned (number, order, types)

Need transformationsNeed transformations Functions and equationsFunctions and equations Tables of valuesTables of values Pre and post conditionsPre and post conditions Decision tablesDecision tables Pseudo codePseudo code Natural languageNatural language

Page 32: Functional Modeling 081 0. Question How do you know if you have enough information to compute the necessary output values? How do you know if you have

Operations

TrivialTrivial Access: read or write attributes. May not Access: read or write attributes. May not

be necessary to show all of these.be necessary to show all of these. Non-trivialNon-trivial

Queries: no side effectsQueries: no side effects Actions: “instantaneous” (atomic)Actions: “instantaneous” (atomic) Activities: duration over timeActivities: duration over time