© minder chen, 1999-2002 structured design - 1 produce paycheck retrieve employee record global...
TRANSCRIPT
© Minder Chen, 1999-2002 Structured design - 1Structured design - 1
Produce Paycheck
Retrieve Employee
Record
Global Data Store Offpage
Calling Module
Called Module
System Device
Module
Module Name
Normal Procedure (Subroutine) Call
Module Name
Library(Predefined) Module
Global Data Store Used by Page-Jones
Offpage
Used by Page-Jones
Sender
Receiver
Control Flag
DataData
Structure Chart NotationsStructure Chart Notations
© Minder Chen, 1999-2002 Structured design - 2Structured design - 2
Module Module1 ' The argument x is passed by value ' The argument y is passed by reference Public Sub ABC(ByVal x As Integer, ByRef y As Integer) ' If ABC changes x, the changes do not affect a. ' If ABC changes y, the changes affect b. x = x + 1 y = y + 1 End Sub
Public Sub Main() Dim a As Integer = 3 Dim b As Integer = 4 ABC(a, b) ' Call the procedure. Console.WriteLine("a = " & a) Console.WriteLine("b = " & b) ' You can force parameters to be passed by value, regardless of how ' they are declared, by enclosing the parameters in extra parentheses. ABC((x)) End Sub
End Module
© Minder Chen, 1999-2002 Structured design - 3Structured design - 3
Dim a As Integer = 3Dim b As Integer = 4ABC(a, b)Console.WriteLine("a = " & a)Console.WriteLine("b = " & b)
Public Sub ABC(ByVal x As Integer, ByRef y As Integer) x = x + 1 y = y + 1End Sub
x y
3a
4b
3x
y
3
5
Before After
Before After
4
© Minder Chen, 1999-2002 Structured design - 4Structured design - 4
A
A,1 A,2 A,3
Call A,1Call A,2Call A,3
SequenceStructured Chart NotationsStructured Chart Notations
A
A,4A,3A,2A,1
Call A,1IF Tx-Code = “A” Then Call A,2ELSE IF Tx-Code = “B” Then Call A,3
ELSE IF Tx-Code =“C” THEN Call A,4
Decision
A
A,1 A,2 A,3 A,4
Call A,1Repeat
Call A,2Call A,3Call A,4
Until EOF = “true”
AA
A,3A,3A,1A,1 A,2A,2 Statement X Statement T Statement Z
Statement X Statement T Statement Z
Call A,1 Statement X Statement Y StatementZ Call A,3
Call A,1 Statement X Statement Y StatementZ Call A,3
IterationIteration Lexical InclusionLexical Inclusion
© Minder Chen, 1999-2002 Structured design - 5Structured design - 5
Structured Chart Notations (Contd.)Structured Chart Notations (Contd.)
Notations used by Page-JonesNotations used by Page-Jones
DecisionDecisionIterationIteration
Lexical Inclusion (The Hat Symbol)
Lexical Inclusion (The Hat Symbol)
© Minder Chen, 1999-2002 Structured design - 6Structured design - 6
Structure Chart NotationsStructure Chart Notations
Interface Table
I/F# Input Output
1 A,B C
2 X Y,Z
Interface Table
1 2
Asynchronous Activation of a Subtask
Concurrent Activation Symbol
Information Cluster
A B C
D
Modules A, B, and C has exclusive access to Data D
Program X
Physical Packaging Boundary
© Minder Chen, 1999-2002 Structured design - 7Structured design - 7
Sample Structure Chart 2.0 Enter Customer payments
2.5 Display Customer payment
2.32 Verify Customer account
2.21 Get Customer record
2.11 Key invoice remittance
2.4 write Customer payment transaction
2.3 Update A/R master
2.2 Add Customer information
2.1 Key remittance
2.33 Rewrite A/R record
2.22 Verify Customer account
2.31 Get receivable record
2.12 Key monthly statement remittance
Structure chart for program 2.0. Enter customer payment Exercise - 3
Remittance
EOT
Customer-ID
Invoice-remittance
Monthly-Statement-remittance
Customer-sold-to-name
Remittance
Remittance
Customer-sold-to-name
Customer-payment
Customer-ID
Customer-ID
Customer-IDCustomer-number
Customer-record
Customer-record
No-record-on-file
Valid-account
A/R-record
Old-A/R-record
New-A/R-record
No-record-on-file
Valid account
Posting-ok
© Minder Chen, 1999-2002 Structured design - 8Structured design - 8
How would you partition this system?How would you partition this system?
© Minder Chen, 1999-2002 Structured design - 9Structured design - 9
Type of Coupling
Tightness of Coupling
Goodness of Design
Normal Coupling
Data Coupling Stamp Coupling
Control Coupling
Common Coupling
Content Coupling
Loose
Tight
Good
Bad
© Minder Chen, 1999-2002 Structured design - 10Structured design - 10
Normal CouplingNormal Coupling
A .
Call B .
A .
Call B using X,Y
.
B B
Module A and module B are normally coupled if - A calls B- B returns to A
All information passed between them are through parameter passing
XX YY
© Minder Chen, 1999-2002 Structured design - 11Structured design - 11
UPDATE CUSTOMER
MASTER FILE
GET VALID INPUT
VALIDATE CUSTOMER
TRANSACTION
UPDATE MASTER
PUT CUSTOMER
MASTER
GET INPUT
GET CUSTOMER
MASTER
GET CUSTOMER
TRANS
Transaction
Transaction
Transaction is valid
Transaction
Master Record
Master Record
Acct Number
Master Record
Updated Master RecordMaster
RecordValid Trans-action
Updated Master Record
Valid Trans-action
© Minder Chen, 1999-2002 Structured design - 12Structured design - 12
Data CouplingData CouplingCalculate
Monthly payment
of a House
Calculate Mortgage
Payment
Mortgage PaymentLoan Amount
Term
Interest Rate
Module A and module B are data coupled if - A calls B - B returns to A - All information passed between them are through parameter passing - Each parameter is a data element
© Minder Chen, 1999-2002 Structured design - 13Structured design - 13
Stamp CouplingStamp Coupling
Calculate
Monthly Payment
of a House
Calculate
Mortgage
Payment
Mortgage PaymentCustomer Loan Record
Two module A and B are data coupled if - A calls B - B returns to A - All information passed between them are through parameter passing - A composite piece of data is passed from one module to another
© Minder Chen, 1999-2002 Structured design - 14Structured design - 14
Control CouplingControl Coupling
Produce
paycheck
Retrieve Employee
Record
Produce
paycheck
Retrieve Employee
Record
Employee ID
Employee Record Employee Record
Employee ID
Tell the operator that “The Employee Record Is Not Found”
Employee Record Not Found
Control Flag Descriptive Flag
© Minder Chen, 1999-2002 Structured design - 15Structured design - 15
Scale of CohesionScale of Cohesion
Types of Cohesion Visibility Strength of Cohesion Maintainability
Functional Black box
Functional Black box Sequential Not-quite soSequential Not-quite so
Communicational black boxCommunicational black box
Procedural Gray Procedural Gray
Temporal boxTemporal box
Logical TransparentLogical Transparent
Coincidental or white box Coincidental or white box
StrongStrong
WeakWeak
GoodGood
BadBad
© Minder Chen, 1999-2002 Structured design - 16Structured design - 16
Structure Chart and DFD Structure Chart and DFD
This module is sequentially cohesive.This module is sequentially cohesive.
This module is communicationally cohesive.This module is communicationally cohesive.
© Minder Chen, 1999-2002 Structured design - 17Structured design - 17
Simplify Communicational Cohesion Simplify Communicational Cohesion
Get Employee Name
Calculate YTD Total Deduction
Get Employee Name
Calculate YTD Total Deduction Get Employee Name Get Employee Name Calculate YTD Total DeductionCalculate YTD Total Deduction
Employee NameEmployee Name
Employee YTD Total Deduction
Employee YTD Total Deduction
Employee IDEmployee ID Employee IDEmployee IDEmployee IDEmployee IDEmployee YTD Total Deduction
Employee YTD Total Deduction
Employee NameEmployee Name
© Minder Chen, 1999-2002 Structured design - 18Structured design - 18
Determine Module CohesionDetermine Module CohesionType of Cohesion Type of Cohesion
Does activities performed by the module related to a single problem-related task
Does activities performed by the module related to a single problem-related task
What relates the elements within the module ?
What relates the elements within the module ?
Neither data nor control
Neither data nor control
Is sequence important ?
Is sequence important ?
DataData
Flow of control
Flow of control
Is sequence important ?
Is sequence important ?
Are the activities performed by the elements in the same category?
Are the activities performed by the elements in the same category?
YESYES
YES YES
YESYES
NONO
NONO
NONO
FunctionalFunctional
SequentialSequential
CommunicationalCommunicational
ProceduralProcedural
TemporalTemporal
LogicalLogical
CoincidentalCoincidental
© Minder Chen, 1999-2002 Structured design - 19Structured design - 19
DETERMINE CUSTOMER
DETAILS
DETERMINE CUSTOMER
DETAILS
Customer Account Number
Customer Name
Customer Loan Status
Customer Loan Status
Customer Account Number
Customer Account Number
Customer Name
Customer Name
A Communicationally Cohesive Module at the Bottom of a Structure Chart
A Communicationally Cohesive Module Halfway Up a Structure Chart
Each of These Functionally Cohesive Module is at the Bottom of a Structure
Customer Name
Customer Account Number
EVALUATE LOAN
STATUS
FIND CUSTOMER
NAME
© Minder Chen, 1999-2002 Structured design - 20Structured design - 20
A Functionally Cohesive Module Very High in a Structure Chart
Satellite Trajectory
Elevation
Ranges
AzimuthsTimes
GET RANGES
GET TIMES
GET AZIMUTHS
GET ELEVATION
GET SATELLITE
TRAJECTORY
© Minder Chen, 1999-2002 Structured design - 21Structured design - 21
The Impact of Module Numbers on CostThe Impact of Module Numbers on Cost
Inte
rmodule
Effe
cts (
Coupling)
Cost Due to
Cost Due toIntramodule Effects (Cohesion)
High
Low
Co
st
Number of ModulesSmall Large
© Minder Chen, 1999-2002 Structured design - 22Structured design - 22
Four Basic Types of ModulesFour Basic Types of Modules
Coordinate control
Transform (Process)
Transform (Process)
Efferent (Output)
Efferent (Output)
Afferent (Input)
© Minder Chen, 1999-2002 Structured design - 23Structured design - 23
Idea System Shape of a Structure ChartIdea System Shape of a Structure Chart
Afferent branch
Transform branch
Efferent branch
© Minder Chen, 1999-2002 Structured design - 24Structured design - 24
Boulding’s Explanation of GST
"(General Systems Theory) does not seek, ofcourse, to establish a single, self contained'general theory' of practically everything whichwill replace the theories of particular disciplines.Such a theory would be almost without content,for we always pay for generality by sacrificingcontent, and we can say about practicallyeverything is almost nothing. Somewhere howeverbetween the specific that has no meaning and thegeneral that has no content there must be, foreach purpose and at each level of abstraction, anoptimum degree of generality. It is the contentionof the General Systems Theorists that thisoptimum degree of generality is not alwaysreached by the particular sciences."
Source: http://cimru.nuigalway.ie/david/pdf/SE/Slides/Theory.PDFSource: http://cimru.nuigalway.ie/david/pdf/SE/Slides/Theory.PDF
© Minder Chen, 1999-2002 Structured design - 25Structured design - 25
Idea System Shape of a Structure ChartIdea System Shape of a Structure Chart
High fan-outHigh fan-out
High fan-inHigh fan-in
© Minder Chen, 1999-2002 Structured design - 26Structured design - 26
The Procedure of Deriving Structure Charts from Data Flow Diagrams
The Procedure of Deriving Structure Charts from Data Flow Diagrams
Evaluate a detailed DFD
Type of DFD
Identify central transform of the DFD
Map to transaction structure Map to transform structure
Refined the Structure Chart
Identify transaction types and transaction center of the DFD
Transaction Analysis Transform
Analysis
© Minder Chen, 1999-2002 Structured design - 27Structured design - 27
P
OUTPUTFUNCTION
C
P
INPUTFUNCTION
B
P
INPUTFUNCTION
D
P
OUTPUTFUNCTION
A
P
INPUTFUNCTION
C
POUTPUT
FUNCTIONB
P
TRANSFORMFUNCTION
A
P
TRANSFORMFUNCTION B
P
INPUTFUNCTION
A
BOUNDARYB
BOUNDARYA
D DATA STORE D
D DATA STORE B
D DATA STORE E
M
L
K
J
I
H
G
F
E
D
C
B
A
Afferent
CentralTransform
Efferent
Transform Analysis
© Minder Chen, 1999-2002 Structured design - 28Structured design - 28
TRANSFORMFUNCTION
A
TRANSFORMFUNCTION
B
INPUTFUNCTION
A
INPUTFUNCTION
D
INPUTFUNCTION
B
OUTPUTFUNCTION
A
INPUTFUNCTION
C
OUTPUTFUNCTION
C
BOSS
CENTRALTRANSFORMCONTROLLER
OUTPUTFUNCTION
B
E & F
J & I
J
G & H
E, F, & GI
J
G
I
F
K
E
C
© Minder Chen, 1999-2002 Structured design - 29Structured design - 29
Transaction Analysis
DFD
Get Customer Transactio
n
Get Customer Transactio
n
Get Customer Transactio
nGet
Customer Transactio
n Get Customer Transactio
n
Process Customer Transaction
Change Customer
Record
Add New Customer
Get Customer
Transaction
Delete Customer
Record
Tx-Code
Structure Chart
Customer Information System Main Menu
1. Add New Customer 2. Change Customer Record 3. Delete Customer Record
A Transaction Selection Screen
© Minder Chen, 1999-2002 Structured design - 30Structured design - 30
Determine Implementation BoundariesDetermine Implementation Boundaries
ManualManualReal-timeReal-time
Batch
On-line
© Minder Chen, 1999-2002 Structured design - 31Structured design - 31
Processor Model: Allocation of essential Model Components to Processors
Essential Model
Processor 1
Processor 2
Processor 3
Processor Level Implementation Model
Netware LAN
UNIX Server
T1
TCP/IP
Mainframe
Allocating processes and data stores to
processors
© Minder Chen, 1999-2002 Structured design - 32Structured design - 32
Source: Developing Web Applications with Microsoft Visual Basic .NET and Microsoft Visual C# .NET
Testing• Test plan objectives
– Is thoroughly tested– Meets requirements– Does not contain defects
• Test plan covers– Tools– Who– Schedule– Test result analysis– What is being tested?
• Test cases• Automated testing
– Reproducible – Measurable
© Minder Chen, 1999-2002 Structured design - 33Structured design - 33
Stubs and Drivers
Driver
Module 1 Module 2
Module M
Stub Module 2
• Stubs Stubs are non-functional components that provide the class, property, or method definition used by the other component. Stubs are a kind of outline of the code you will create later.
• To test two components that need to work together through a third component that has not been written yet, you create a driver. Drivers Drivers are simply test components that make sure two or more components work together. Later in the project, testing performed by the driver can be performed by the actual component.
The most common build problem occurs when one component tries to use another component that has not yet been written. This occurs with modular design because the components are often created out of sequence.
© Minder Chen, 1999-2002 Structured design - 34Structured design - 34
Test type Objectives
Unit testEach independent piece of code works
correctly
Integration test
All units work together without errors
Regression test
Newly added features do not introduce errors to other features that are already working
Load test (also called stress test)
The product continues to work under extreme usage
Platform testThe product works on all of the target
hardware and software platforms
Types of Tests
© Minder Chen, 1999-2002 Structured design - 35Structured design - 35
Regression and Regression Test
• Regression testing is the process of validating modified parts of the software and ensuring that no new errors are introduced into previously tested code.
• Unit and integration tests form the basis of regression testing. As each test is written and passed, it gets checked into the test library for a regularly scheduled testing run. If a new component or a change to an existing component breaks one of the existing unit or integration tests, the the error is called a regression.error is called a regression.
© Minder Chen, 1999-2002 Structured design - 36Structured design - 36
© Minder Chen, 1999-2002 Structured design - 37Structured design - 37