Classic Analysis CS524 – Software Engineering I Azusa Pacific University Professor Dr. Sheldon X....
-
Upload
alyssa-tenison -
Category
Documents
-
view
217 -
download
0
Transcript of Classic Analysis CS524 – Software Engineering I Azusa Pacific University Professor Dr. Sheldon X....
Classic AnalysisClassic Analysis
CS524 – Software Engineering ICS524 – Software Engineering I
Azusa Pacific UniversityAzusa Pacific University
Professor Dr. Sheldon X. LiangProfessor Dr. Sheldon X. Liang
Classical designClassical design
References:References:Structured Analysis and System SpecificationStructured Analysis and System Specification – Tom – Tom DemarcoDemarco
Structured Design: Fundamentals of a Discipline of Structured Design: Fundamentals of a Discipline of Computer Program and System DesignComputer Program and System Design – Edward – Edward YourdonYourdon
Object-Oriented & Classical Software EngineeringObject-Oriented & Classical Software Engineering – – Stephen R. SchachStephen R. SchachThe Z NotationThe Z Notation – J.M. Spivey – J.M. Spivey
dictionary.comdictionary.com
What is Classical Analysis?What is Classical Analysis?
Systems Analysis:Systems Analysis:
1. the evaluation of an activity to identify 1. the evaluation of an activity to identify its desired objectives and determine its desired objectives and determine procedures for efficiently attaining them. procedures for efficiently attaining them.
What is Classical Analysis?What is Classical Analysis?
Systems Analysis:Systems Analysis:
2.Computers. the methodical study of the 2.Computers. the methodical study of the data-processing needs of a business or data-processing needs of a business or department, together with department, together with recommendations for specific hardware recommendations for specific hardware and software installations.and software installations.
Role of the AnalystRole of the Analyst
The analyst is the liaison between the user The analyst is the liaison between the user and the development team.and the development team.
His final product must be understandable His final product must be understandable to the users and the developers.to the users and the developers.
He doesn’t tell the developers how to He doesn’t tell the developers how to create the product, just what it should do create the product, just what it should do in a very exacting manner.in a very exacting manner.
The Goal of AnalysisThe Goal of Analysis
The most important product of systems The most important product of systems analysis – is the specification document.” - analysis – is the specification document.” - DeMarcoDeMarco Informal enough for the clientInformal enough for the client
The client is generally not a computer specialistThe client is generally not a computer specialist
Formal enough for the developersFormal enough for the developersIt is the sole source of information for drawing up It is the sole source of information for drawing up the designthe design
Completion of the Analysis PhaseCompletion of the Analysis Phase
Successful completion of the analysis Successful completion of the analysis phase involves all of the following: phase involves all of the following: (DeMarco)(DeMarco)
1.1. Selecting an optimal targetSelecting an optimal target
2.2. Producing detailed documentation of that Producing detailed documentation of that target in such a manner that subsequent target in such a manner that subsequent implementation can be evaluated to see implementation can be evaluated to see whether or not the target has been obtainedwhether or not the target has been obtained
Completion of the Analysis PhaseCompletion of the Analysis Phase
Successful completion of the analysis Successful completion of the analysis phase involves all of the following: phase involves all of the following: (contd)(contd)
3.3. Producing accurate predictions of the Producing accurate predictions of the important parameters associated with the important parameters associated with the target, including costs, benefits, schedules target, including costs, benefits, schedules and performance characteristics.and performance characteristics.
4.4. Obtaining concurrence on each of the items Obtaining concurrence on each of the items above from each of the affected partiesabove from each of the affected parties
Specification DocumentSpecification Document
The specification document is the final The specification document is the final product of the systems analystproduct of the systems analyst
It is a contract between the client and the It is a contract between the client and the developerdeveloper
Specifies what the product must do and Specifies what the product must do and the constraints on the productthe constraints on the product
Methods of AnalysisMethods of Analysis
Three popular graphical specification Three popular graphical specification methods of ’70smethods of ’70s DeMarcoDeMarco Gane and SarsenGane and Sarsen YourdonYourdon
All are equivalentAll are equivalent
All are equally goodAll are equally good
Methods of AnalysisMethods of Analysis
Demarco(1979) – Data Flow DiagramDemarco(1979) – Data Flow Diagram Data DictionaryData Dictionary Structured EnglishStructured English Decision TablesDecision Tables Decision TreesDecision Trees
Structured Systems AnalysisStructured Systems Analysis
Gane and Sarsen’s Structured System Analysis Gane and Sarsen’s Structured System Analysis Nine Step process to analyze the clients needsNine Step process to analyze the clients needs Stepwise refinement is used in many stepsStepwise refinement is used in many steps
1.1. Draw the data flow diagram.Draw the data flow diagram.2.2. Decide what sections to computerize and how (batch or online).Decide what sections to computerize and how (batch or online).3.3. Determine the details of the data flows.Determine the details of the data flows.4.4. Define the logic of the process.Define the logic of the process.5.5. Define the data storesDefine the data stores6.6. Define the physical resources.Define the physical resources.7.7. Determine the input-output specifications.Determine the input-output specifications.8.8. Perform the sizing.Perform the sizing.9.9. Determine the hardware requirements.Determine the hardware requirements.
Structured Systems AnalysisStructured Systems Analysis
Sally’s Software Shop buys software from Sally’s Software Shop buys software from various suppliers and sells it to the public. various suppliers and sells it to the public. Popular software packages are kept in stock, but Popular software packages are kept in stock, but the rest must be ordered as required. the rest must be ordered as required. Institutions and corporations are given credit Institutions and corporations are given credit facilities, as are some members of the public. facilities, as are some members of the public. Sally’s Software Shop is doing well, with a Sally’s Software Shop is doing well, with a monthly turnover of 300 packages at an average monthly turnover of 300 packages at an average retail cost of $250 each. Despite her business retail cost of $250 each. Despite her business success, Sally has been advised to computerize. success, Sally has been advised to computerize. Should she? Should she?
Structured Systems AnalysisStructured Systems Analysis
The analysts job:The analysts job: What business functions should she What business functions should she
computerize?computerize?Accounts payableAccounts payable
Accounts receivableAccounts receivable
InventoryInventory What equipment will they need?What equipment will they need? How much are they willing to spend?How much are they willing to spend?
Step 1. Draw the DFDStep 1. Draw the DFDThe data flow diagram (DFD) shows the logical data flow The data flow diagram (DFD) shows the logical data flow ““What happens, not how it happens”What happens, not how it happens”
First refinementFirst refinement Infinite number of possible interpretationsInfinite number of possible interpretations
Second refinementSecond refinement PENDING ORDERSPENDING ORDERS is scanned daily is scanned daily
Step 1. Draw the DFDStep 1. Draw the DFD
Step 1. Draw the DFDStep 1. Draw the DFD
Portion of third refinementPortion of third refinement
Step 2. Decide What Parts to Step 2. Decide What Parts to Computerize and HowComputerize and How
It depends on how much client is prepared to It depends on how much client is prepared to spendspend
Large volumes, tight controlsLarge volumes, tight controls BatchBatch
Small volumes, in-house microcomputerSmall volumes, in-house microcomputer OnlineOnline
Cost/benefit analysisCost/benefit analysis
Step 3. Determine the Details of Step 3. Determine the Details of the Data Flowsthe Data Flows
Determine the data items for each data flowDetermine the data items for each data flowRefine each flow stepwiseRefine each flow stepwiseWe need a data dictionary for larger productsWe need a data dictionary for larger products
Step 4. Define the Logic of the Step 4. Define the Logic of the ProcessesProcesses
We have process We have process give educational discountgive educational discount
Sally must explain the discount she gives to Sally must explain the discount she gives to educational institutionseducational institutions
10% on up to 4 packages10% on up to 4 packages
15% on 5 or more15% on 5 or more
Step 4 . Define the Logic of the Step 4 . Define the Logic of the Processes (contd)Processes (contd)
Translate this into a decision treeTranslate this into a decision treeGive educational discount
Educational Institution
Other: 0%
< or = 4 packages: 10%
> 4 packages: 15%
The advantage of a decision treeMissing items are quickly apparent
Determine Football Seat Prices
Faculty
Undergraduate
Alumnus
40 yard line: $20
End zone: $12
$2.00
40 yard line: $40
Step 5. Define the Data StoresStep 5. Define the Data StoresDefine the exact contents and representation (format) Define the exact contents and representation (format) Java: specify to Java: specify to int/stringint/string level level Ada: specify Ada: specify digitsdigits or or deltadelta
Specify where immediate access is requiredSpecify where immediate access is required Data immediate-access diagram (DIAD)Data immediate-access diagram (DIAD)
Step 6. Define the Physical Step 6. Define the Physical ResourcesResources
For each file, specifyFor each file, specify File nameFile name Organization (sequential, indexed, etc.)Organization (sequential, indexed, etc.) Storage mediumStorage medium Blocking factorBlocking factor Records (to field level)Records (to field level) Table information, if a DBMS is to be usedTable information, if a DBMS is to be used
Step 7. Determine Input/Output Step 7. Determine Input/Output SpecificationsSpecifications
Specify Specify Input formsInput forms Input screensInput screens Printed outputPrinted output
Step 8. Determine the SizingStep 8. Determine the Sizing
Obtain the numerical data needed in Step Obtain the numerical data needed in Step 9 to determine the hardware requirements9 to determine the hardware requirements Volume of input (daily or hourly)Volume of input (daily or hourly) Size, frequency, deadline of each printed Size, frequency, deadline of each printed
reportreport Size, number of records passing between Size, number of records passing between
CPU and mass storageCPU and mass storage Size of each fileSize of each file
Step 9. Determine the Hardware Step 9. Determine the Hardware RequirementsRequirements
Mass storage requirementsMass storage requirements
Mass storage for back-upMass storage for back-up
Input needsInput needs
Output devices Output devices
Is the existing hardware adequate?Is the existing hardware adequate? If not, recommend whether to buy or lease If not, recommend whether to buy or lease
additional hardwareadditional hardware
Structured Systems AnalysisStructured Systems Analysis
Response times cannot be determinedResponse times cannot be determinedThe number of I/O channels can only be The number of I/O channels can only be guessedguessedCPU size and timing can only be guessedCPU size and timing can only be guessedNevertheless, no other method provides these Nevertheless, no other method provides these data for arbitrary productsdata for arbitrary products
OverallOverallThe method of Gane and Sarsen/De Marco/ The method of Gane and Sarsen/De Marco/ Yourdon has resulted in major improvements in Yourdon has resulted in major improvements in the software industrythe software industry
Entity-Relationship ModelingEntity-Relationship ModelingSemi-formal techniqueSemi-formal technique Widely used for specifying Widely used for specifying
databasesdatabases ExampleExample
Author
Novel
Reader
Writes
Reads Owns
1
1 1
n
n n
Many-to-many relationship
Supplier
Part
Is supplied By
m
n
Finite State MachinesFinite State MachinesA finite state machine (FSM) is a model of A finite state machine (FSM) is a model of
behavior composed of a finite number of behavior composed of a finite number of statesstates, transitions between those states, , transitions between those states, and actions.and actions.
Finite State MachinesFinite State MachinesCase studyCase study
A safe has a combination lock that can be in one of three positions, labeled 1, 2, A safe has a combination lock that can be in one of three positions, labeled 1, 2, and 3. and 3. The dial can be turned left or right (L or R). The dial can be turned left or right (L or R). Thus there are six possible dial movements, namely 1L, 1R, 2L, 2R, 3L, and 3R. Thus there are six possible dial movements, namely 1L, 1R, 2L, 2R, 3L, and 3R. The combination to the safe is 1L, 3R, 2L; any other dial movement will cause the The combination to the safe is 1L, 3R, 2L; any other dial movement will cause the alarm to go off alarm to go off
Finite State Machines (contd)Finite State Machines (contd)
The set of states J is {Safe Locked, A, B, The set of states J is {Safe Locked, A, B, Safe Unlocked, Sound Alarm}Safe Unlocked, Sound Alarm}
The set of inputs K is {1L, 1R, 2L, 2R, 3L, The set of inputs K is {1L, 1R, 2L, 2R, 3L, 3R}3R}
The initial state J is Safe LockedThe initial state J is Safe Locked
The set of final states J is {Safe Unlocked, The set of final states J is {Safe Unlocked, Sound Alarm}Sound Alarm}
Figure 11.14
Finite State Machines (contd)Finite State Machines (contd)
Transition table – so you can write it as a Transition table – so you can write it as a matrix to be machine readable.matrix to be machine readable.
11.8 Petri Nets11.8 Petri Nets
A major difficulty with specifying real-time A major difficulty with specifying real-time systems is timingsystems is timing Synchronization problemsSynchronization problems Race conditionsRace conditions DeadlockDeadlock
Often a consequence of poor Often a consequence of poor specificationsspecifications
Petri Nets (contd)Petri Nets (contd)
Petri netsPetri nets Technique for specifying systems that have Technique for specifying systems that have
potential problems with interrelationspotential problems with interrelations
A Petri net consists of four parts: A Petri net consists of four parts: A set of placesA set of places P P A set of transitionsA set of transitions T T An input functionAn input function I I An output functionAn output function O O
Petri Nets (contd)Petri Nets (contd)Set of placesSet of places P P is is {p{p11, p, p22, p, p33, p, p44}}
Set of transitionsSet of transitions
T T isis {t {t11, t, t22}}
Input functions:Input functions:I(tI(t11) = {p) = {p22, ,
pp44}}
I(tI(t22)) = {p= {p22}}
Output Output functions:functions:
O(tO(t11) = {p) = {p11}}
O(tO(t22) = {p) = {p33, , pp33}}
Figure 11.18
Petri Nets (contd)Petri Nets (contd)More formally, a Petri More formally, a Petri net is a 4-tuplenet is a 4-tuple C = (P, T, I, C = (P, T, I, O)O)
P = {pP = {p11, p, p22,…,p,…,pnn} } is a finite is a finite set of set of placesplaces,, n ≥ 0 n ≥ 0
T = {tT = {t11, t, t22,…,t,…,tmm} is a finite set } is a finite set
of of transitionstransitions, m ≥ 0, with P , m ≥ 0, with P
and T and T disjointdisjoint I : T I : T P P∞∞ is the is the input input
function, a mapping function, a mapping from transitions to bags from transitions to bags of placesof places
Petri Nets (contd)Petri Nets (contd) O : T O : T P P∞∞ is the is the output output
function, a mapping from function, a mapping from transitions to bags of transitions to bags of placesplaces
(A(A bag bag is a is a generalization of a set generalization of a set that allows for multiple that allows for multiple instances of elements, instances of elements, as in the example on the as in the example on the previous slide)previous slide)
AA marking marking of a Petri net of a Petri net is an assignment of is an assignment of tokens to that Petri nettokens to that Petri net
Petri Nets (contd)Petri Nets (contd)
Four tokens: one inFour tokens: one in p p11,, two in two in p p22, none in, none in p p33, and one in, and one in pp44
Represented by the vector Represented by the vector (1,2,0,1)(1,2,0,1)
Figure 11.19
Petri Nets (contd)Petri Nets (contd)
A transition is enabled if each of its input A transition is enabled if each of its input places has as many tokens in it as there are places has as many tokens in it as there are arcs from the place to that transitionarcs from the place to that transition
Petri Nets (contd)Petri Nets (contd)TransitionTransition t t11 is enabled is enabled (ready to fire)(ready to fire) IfIf t t11 fires, one token is fires, one token is
removed fromremoved from p p22 and one and one fromfrom p p44, and one new , and one new token is placed intoken is placed in p p1 1
TransitionTransition t t22 is also is also enabledenabled
Important: Important: The number of tokens is The number of tokens is
not conservednot conserved
Petri Nets (contd)Petri Nets (contd)
Petri nets are indeterminatePetri nets are indeterminate SupposeSuppose t t11 firesfires
The resulting marking is The resulting marking is (2,1,0,0) (2,1,0,0)
Petri Nets (contd)Petri Nets (contd)Now onlyNow only t t22 is enabled is enabled It fires It fires
The marking is now The marking is now (2,0,2,0)(2,0,2,0)
Petri Nets (contd)Petri Nets (contd)
More formally, a markingMore formally, a marking M M of a Petri net of a Petri net C = (P, T, I, O) C = (P, T, I, O)
is a function from the set of placesis a function from the set of places P P to the to the non-negative integersnon-negative integers
M : P M : P {0, 1, 2, …} {0, 1, 2, …}
A marked Petri net is then a 5-tupleA marked Petri net is then a 5-tuple (P, T, I, (P, T, I, O, M )O, M )
Petri Nets (contd)Petri Nets (contd)
Inhibitor arcsInhibitor arcs An inhibitor arc is marked by a small circle, not An inhibitor arc is marked by a small circle, not
an arrowheadan arrowhead
Transition Transition tt11 is enabled is enabled
Petri Nets (contd)Petri Nets (contd)
In general, a transition is enabled if there In general, a transition is enabled if there is at least one token on each (normal) is at least one token on each (normal) input arc, and no tokens on any inhibitor input arc, and no tokens on any inhibitor input arcsinput arcs
Z – A Formal Specification LanguageZ – A Formal Specification Language
Z: The Elevator Problem Case Study Z: The Elevator Problem Case Study
A Z specification consists of four sections:A Z specification consists of four sections: 1.1. Given sets, data types, and constantsGiven sets, data types, and constants 2.2. State definitionState definition 3.3. Initial stateInitial state 4.4. OperationsOperations
Given setsGiven sets are sets that need not be defined in detail are sets that need not be defined in detail
Given Set Names appear in brackets Given Set Names appear in brackets
So, for example, here we need the set of So, for example, here we need the set of allall buttons and our buttons and our
specification beginsspecification begins
[Button][Button]
2. State Definition2. State DefinitionZ specification consists of a number of schemata
A schema consists of a group of variable declarations, plus A list of predicates that constrain the values of variables
In this problem there are four subsets of Button The floor buttons The elevator buttons buttons (the set of all buttons in the elevator problem) pushed (the set of buttons that have been pushed)
3. Initial State And Operations3. Initial State And Operations
The state when the system is first turned onThe state when the system is first turned on
BButton_Initutton_Init ^= [ ^= [Button_StateButton_State' | pushed' = ' | pushed' = ]]
A button pushed for the first time is turned on, and added to set pushed
Without the third precondition, the results would be unspecified
Z: Z: The Elevator Problem Case StudyThe Elevator Problem Case Study
If an elevator arrives at a floor, the If an elevator arrives at a floor, the corresponding button(s) must be turned offcorresponding button(s) must be turned off
This example is VERY oversimplified – doesn’t This example is VERY oversimplified – doesn’t distinguish between up and down floor buttonsdistinguish between up and down floor buttons
Analysis of ZAnalysis of ZZ is the most widely used formal languageZ is the most widely used formal language
It has been used to specifyIt has been used to specify CICS (part)CICS (part) An oscilloscopeAn oscilloscope A CASE toolA CASE tool Many large-scale projects (especially in Europe)Many large-scale projects (especially in Europe)
Difficulties in using ZDifficulties in using Z The large and complex set of symbolsThe large and complex set of symbols Training in mathematics is neededTraining in mathematics is needed
Analysis of ZAnalysis of Z
Reasons for the great success of ZReasons for the great success of Z It is easy to find faults in Z specificationsIt is easy to find faults in Z specifications The specifier must be extremely preciseThe specifier must be extremely precise We can prove correctness (though we don’t have We can prove correctness (though we don’t have
to)to) Only high-school math needed to Only high-school math needed to readread Z Z Z decreases development timeZ decreases development time A “translation” of a Z specification into English (or A “translation” of a Z specification into English (or
another natural language) is clearer than an another natural language) is clearer than an informal specificationinformal specification
Comparison of Classical Analysis Comparison of Classical Analysis TechniquesTechniques
Formal methods areFormal methods are Powerful, butPowerful, but Difficult to learn and useDifficult to learn and use
Informal methods haveInformal methods have Little power, but areLittle power, but are Easy to learn and useEasy to learn and use
There is therefore a trade-offThere is therefore a trade-off Ease of use versus powerEase of use versus power
Comparison of Classical Analysis Comparison of Classical Analysis Techniques (contd)Techniques (contd)
Figure 11.29Figure 11.29
CASE Tools for Classical AnalysisCASE Tools for Classical Analysis
A graphical tool is exceedingly usefulA graphical tool is exceedingly useful
So is a data dictionarySo is a data dictionary Integrate themIntegrate them
An analysis technique without CASE tools to An analysis technique without CASE tools to support it will failsupport it will fail The SREM experienceThe SREM experience
Typical toolsTypical tools Analyst/DesignerAnalyst/Designer Software through PicturesSoftware through Pictures System ArchitectSystem Architect
Metrics for CASE ToolsMetrics for CASE ToolsFive fundamental metricsFive fundamental metrics Size, cost, duration, effort & qualitySize, cost, duration, effort & quality
QualityQuality Fault statisticsFault statistics The number, type of each faultThe number, type of each fault The rate of fault detectionThe rate of fault detection
Metrics for “predicting” the size of a target productMetrics for “predicting” the size of a target product Total number of items in the data dictionaryTotal number of items in the data dictionary The number of items of each typeThe number of items of each type Processes vs. modulesProcesses vs. modules
Challenges of Classical AnalysisChallenges of Classical Analysis
A specification document must beA specification document must be Informal enough for the client; butInformal enough for the client; but Formal enough for the development teamFormal enough for the development team
Analysis (“what”) should not cross the Analysis (“what”) should not cross the boundary into design (“how”)boundary into design (“how”)
Do not try to assign modules to process Do not try to assign modules to process boxes of DFDs until the classical design boxes of DFDs until the classical design phasephase