4 The Process of Finalizing Design Specifications n Less costly to correct and detect errors during the design phase n Deliverable: a set of design specifications for the entire system, with detailed functional descriptions of each system component
Jump to first page 5 Design Specification Document n Contains: u Overall system description u Interface requirements u System features u Nonfunctional requirements u Other requirements u Supporting diagrams and models
Jump to first page 6 The Structure Chart n Important program design technique n Shows all components of code in a hierarchical format u Sequence – what order of component? u Selection – what condition? u Iteration – how often?
Jump to first page 7 Structure Chart Elements 1.2 Calculate Current GPA Module 1.1 Get Student Grade Record Library Module Loop Conditional Line Control Couple Data Couple Off Page On page
Jump to first page 8 Steps in Building the Structure Chart 1. Identify top level modules and decompose them into lower levels 2. Add control connections 3. Add couples 4. Review and revise again and again until complete
Jump to first page 12 Design Guidelines n High quality structure charts result in programs that are modular, reusable and easy to implement. n Measures include: u Cohesion: extent to which a module performs a single function u Coupling: dependencies between modules u Appropriate levels of fan-in and fan- out
Jump to first page 13 Design Guidelines Software is divided into modules. There should be: Minimum interaction between modules [low coupling] AND High degree of interaction within a module [high cohesion] Therefore, an individual module can be DESIGNED, CODED, TESTED OR CHANGED easily.
Jump to first page 14 Types of Cohesion n Functional n Sequential n Communicational n Procedural n Temporal n Logical n Coincidental Good Bad
Jump to first page 15 Example of Low Cohesion Logical Cohesion
Jump to first page 16 Types of Coupling n Data n Stamp n Control n Common n Content Good Bad
Jump to first page 17 a cb d hgf e kj i Data structure Data (Var) Control flag No direct coupling Global data area Example of Coupling Level Stamp coupling data coupling control coupling common coupling
Jump to first page 19 Fan-in High fan-in preferred Promotes reuse of subordinate modules 1.1 Calculate Employee Salary 1.2 Print Employee Roster 1.3 Calculate Benefits 2.1.1 Read Employee Record 1.1 Calculate Employee Salary 1.2 Print Employee Roster 1.3 Calculate Benefits 1.1.1 Read Employee Record 1.2.1 Read Employee Record 1.3.1 Read Employee Record Low fan-in not preferred
Jump to first page 20 Quality Checklist 1. Library modules have been created where ever possible 2. The diagram has a high fan-in structure 3. Control modules have no more than 7 subordinates 4. Each module performs only one function (high cohesion) 5. Modules sparingly share information (loose coupling) 6. Data couples that are passed are actually used by the accepting module 7. Control couples are passed from “low to high” 8. Each module has a reasonable amount of code associated with it
Jump to first page 21 Pseudocode n Method used for representing the instructions inside a module n Language similar to computer programming code n Two functions: u Helps analyst think in a structured way about the task a module is designed to perform u Acts as a communication tool between analyst and programmer
Jump to first page 22 Pseudocode Example SET total to zero REPEAT READ Temperature IF Temperature > Freezing THEN INCREMENT total END IF UNTIL Temperature < zero Print total
Jump to first page 23 Summary n In this chapter you learned how to: Read and understand a structure chart Describe measures of good design Understand cohesion and coupling