functional modeling 081 0. question how do you know if you have enough information to compute the...
Post on 12-Jan-2016
216 Views
Preview:
TRANSCRIPT
Functional Modeling
08108100
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?
Functional Models What is a function?What is a function?
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.
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
Simple Example DFD
Compute Average
ComputeGrades
GradesNames
Output Grades
Exam Grades
exam average
Student Names
Grade Book
Exam Grades Grades
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
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
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
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
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
Example
Periodic Table
Findweight
element
Atomicweight
Atomicweights
Initializetable
Atomicweights
Example
Price List
Findcost
Item name
Item name
Cost
Cost
Level 1
ProcessPayroll
EmployeeRecords
TimeCards
Paychecks
AccountingReport
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.
Level 2: Calculate Withholding
ComputeWithholdingRate
Emp. Info.
Acct. Inf.
Paycheck InfoGross Pay
ComputeNet
Rate
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.
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?
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?
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)
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
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)
Activity Diagram Elements
Show “Printing”
inMessageBox
Create pdffile
Sendpdf
to printer
RemoveMessageBox
Customer.Print()
Activity Diagram Elements
Show “Printing”
inMessageBox
Create pdffile
RemoveMessageBox
Customer.Print()
^Printer.Print(file)
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
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)
Three examples of guards[account.balance >= withdraw.amount]
[account.balance < withdraw.amount]
[false]
[true]
<<decisionInput>>[account.balance >= withdraw.amount]
[false]
[true]SufficientBalance?
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
Parallel Actions
Initiate
MeasureUpdate Display
Using Objects to Represent Datastore
Initiate
MeasureUpdate Display
Measured value
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
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
top related