Title: Functional Modeling
1Functional Modeling
2Question
- How do you know if you have enough information to
compute the necessary output values?
3Functional Models
4Steps in constructing Functional Model
- Identify data (e.g. input and output values)
- Identify transformations (e.g., functions)
- Identify sources and sinks for data
- Draw Diagram
- Identify the constraints.
5Data Flow Diagramshttp//www.yourdon.com/strucan
alysis/wiki/index.php?titleChapter_9
- Four things in diagrams
- Processes (ellipses)
- Data flows (arrows)
- Actors (boxes)
- Data stores (open boxes, parallel lines)
Data store
6Simple Example DFD
Exam Grades
Grade Book
Compute Average
Student Names
Grades
Exam Grades
Compute Grades
exam average
Grades Names
Output Grades
7Processes
- Transforms data values
- Drawn as ellipses with fixed number of in-arrows
and out-arrows - Example
dividend
quotient
Integer division
remainder
divisor
8Levels of detail
- Level 1 Shows system inputs, outputs, and
processes - Level 2 Shows inputs, outputs, and processes for
some Level 1 process - Level 3 Shows inputs, outputs, and processes for
some Level 2 process
outputs
inputs
program
9Data Flows
- Connect processes
- Represent intermediate data
- Values are not changed by data flow
- Arrow with name or type of data
city
city
a
address
address
zip
integer
zip
street
Aggregation split
copy
simple
Aggregation join
10Actors
- Producers or consumers of data
- aka terminators, source and sink
- Drawn as rectangle
Customer
11Data Store
- Stores data for later use
- Has exactly two operations
- Store
- Retrieve
- Not an actor must have both store and retrieve
- Drawn as
Data store
12Example
Initialize table
Atomic weights
Periodic Table
Atomic weights
Atomic weight
Find weight
element
13Example
Item name
Price List
Cost
Cost
Find cost
Item name
14Level 1
Employee Records
Paychecks
Process Payroll
TimeCards
Accounting Report
15Level 2 Payroll Process
Format paycheck
Employee Records
Formatted Paycheck.
Paycheck Info
Emp. Info.
Paychecks
Calculate Withholding
Acct. Inf.
Calculate GrossPay
Format Accounting
Gross Pay
Formatted Acct. Inf.
Valid Timecard Info
Validate TimeCard
Accounting Report
TimeCards
Timecard Info.
16Level 2 Calculate Withholding
Emp. Info.
Compute Withholding Rate
Rate
Paycheck Info
Gross Pay
Compute Net
Acct. Inf.
17Notes
- Show all possible computation paths for values.
- Do not show what paths are executed in what order
(thats the job of the dynamic model). - There may be many Level N1 diagrams for each
Level N diagram. Level N1 expands a single node
of a Level N diagram.
18Things to check in DFDs
- Is each requirements function represented by a
transform in the DFDs? - Is each system input and output represented in
the DFDs?
19Things to check in DFDs (contd)
- Are all labels of information flows in the data
dictionary? - Do all data dictionary entries appear in the DFDs?
20UML Activity Diagrams
- Capture Actions and their results
- Similar to state diagrams
- Actions and results show in terms of state
changes - Transitions occur when actions are complete (no
events)
21Purposes of Activity Diagrams
- Capture work (actions) to be performed when an
operation executes - Capture the internal work in an object
- Show how related actions can be performed
- Show how an instance of a use case can be
performed in terms of actions and objects - Show how a business works in terms of actors,
workflows, and objects
22Activity Diagrams
- Actions
- Something performed to produce a result
- An operation may consist of a set of actions
- Drawn as rounded-edged rectangles
- Edges
- Do not have events (except for first edge)
- May have guard conditions, send-clause, or action
expression - Usually have nothing (transition occurs when
action is complete)
23Activity Diagram Elements
Show Printing in MessageBox
Create pdf file
Customer.Print()
Send pdf to printer
Remove MessageBox
24Activity Diagram Elements
Show Printing in MessageBox
Create pdf file
Customer.Print()
Printer.Print(file)
Remove MessageBox
25Activity Diagram Elements
Show Disk Full msg
full
Customer.Print()
free space
Show Printing in MessageBox
Create pdf file
Remove MessageBox
Printer.Print(file)
26Style Points
- Each edge leaving a decision point should have a
guard - Guards on edges leaving decision points must not
overlap (deterministic) - Guards on edges leaving decision points form a
complete set (must be possible to leave the
guard) - otherwise can be used as a fall through case
- Model guards only if they add value
- Simplify Guards (see following)
27Three examples of guards
account.balance gt withdraw.amount
account.balance lt withdraw.amount
true
false
true
false
28More style points
- Include start and end points
- Question black hole (no output edge) and
miracle (no input edge) activities - Use connectors to avoid hard to follow edges, but
make sure they match - Use numbers on connectors
29Parallel Actions
Initiate
Measure
Update Display
30Using Objects to Represent Datastore
Initiate
Measure
Update Display
Measured value
31Specifying Operations in Greater Detail
- Need a signature
- Name
- Arguments (number, order, types)
- Values returned (number, order, types)
- Need transformations
- Functions and equations
- Tables of values
- Pre and post conditions
- Decision tables
- Pseudo code
- Natural language
32Operations
- Trivial
- Access read or write attributes. May not be
necessary to show all of these. - Non-trivial
- Queries no side effects
- Actions instantaneous (atomic)
- Activities duration over time