Structure Chart 1 Intro SE 1 Structure Chart










- Slides: 10

Structure Chart 1. Intro SE 1 Structure Chart – A graphic tool used to hierarchically model the design solution of a problem. Contains: – – – Individual modules Data passed to/from modules Control Interfaces between modules Does NOT contain a complete representation of the internal structure of individual modules. Basic Elements Calling Module Get. Word Control Relationship Called Module Computer Science Dept Va Tech Aug. , 2001 Get. Next Char Intro Data Structures & SE © 1995 -2001 Barnette ND, Mc. Quain WD

Parameter Notation 1. Intro SE 2 Parameter Direction Flow – 3 Types 1. Input: Value Parameters & Const Reference Parameters 2. Output: Reference Parameters (Function changes parameter values independently of parameter’s original [passed] value. ) 3. I/O: Reference Parameters (Function changes parameter values dependent upon of parameter’s original [passed] value. ) Parameter Classes – 2 Classes 1. Data Parameter: 2. Control Parameter: Any parameter upon which NO decision in the called module’s or calling module’s code is based. Any parameter upon which a decision in the called module’s or calling module’s code is based. Get. Word Input Data Output Data Control Parm Input/Output Data Get. Next Char Computer Science Dept Va Tech Aug. , 2001 Intro Data Structures & SE © 1995 -2001 Barnette ND, Mc. Quain WD

Parameter Example 1. Intro SE 3 void Get. Next. Char (. . . ) {. . . Get. Char (ch, uplow, terminator); if (terminator). . . Label with names of actual parameters. Get Next Char uplow ch input data parameter output data parameter terminator Get Char output control parameter void Get. Char(char& chact, uplowtype uplow. Case, bool& terminal ) Note: Function return values are treated as output parameters (list variable to which they are assigned). Calls to multiple functions are usually listed left-right in order of execution. Computer Science Dept Va Tech Aug. , 2001 Intro Data Structures & SE © 1995 -2001 Barnette ND, Mc. Quain WD

Flow Control: Selection 1. Intro SE 4 void Move(. . . ) {. . . if ( ch == plus ) Draw. Box (row, col); . . . ch Label decision with name(s) of variables used in decision. Move Conditional Call ch ch row col Draw Box What does the function header for Draw. Box look like? Computer Science Dept Va Tech Aug. , 2001 Intro Data Structures & SE © 1995 -2001 Barnette ND, Mc. Quain WD

Flow Control: Selection 1. Intro SE 5 void Move(. . . ) {. . . if ( ch == plus ) Draw. Box (row, col); else Draw. Line (row, len); . . . ch Move Conditional Calls ch ch row col Draw Box len Draw Line Select statements are diagrammed in a similar manner with multiple calls emanating from the decision diamond. Computer Science Dept Va Tech Aug. , 2001 Intro Data Structures & SE © 1995 -2001 Barnette ND, Mc. Quain WD

Flow Control: Loop 1. Intro SE 6 void Drawbox (. . . ) {. . . while (ch != plus) {. . . Draw. Line ( dir ); . . . }. . . Label with name(s) of variables used in decision. Draw Box ch Conditional Loop dir Draw Line Computer Science Dept Va Tech Aug. , 2001 Intro Data Structures & SE © 1995 -2001 Barnette ND, Mc. Quain WD

Misc. Routine Calls 1. Intro SE 7 Recursive Routines: – Routines that call themselves Operating System Calls: Predefined Module: – (library routines) Get File fexists Computer Science Dept Va Tech Aug. , 2001 Intro Data Structures & SE © 1995 -2001 Barnette ND, Mc. Quain WD

Connector Symbol 1. Intro SE 8 Large designs span many pages Computer Science Dept Va Tech Aug. , 2001 Intro Data Structures & SE © 1995 -2001 Barnette ND, Mc. Quain WD

Interface Diagram 1. Intro SE 9 Find Coord x, y, z coord Polar Coordinates 3 Reference to Interface Diagram Convert Coord Interface Diagram #3 Parameter Type x data in Cartesian coords y z data in of point data in scale of axis angrad cont in angle degrees (rad) angle data out polar coords dist data out of point Computer Science Dept Va Tech Aug. , 2001 Dir Description Intro Data Structures & SE © 1995 -2001 Barnette ND, Mc. Quain WD

Global Data 1. Intro SE 10 Global Data (extern) – Must be highly justifiable (semi-global) – – separately compiled, module scope Operation Assign Update Reference Copy Get Word Assign Up Case Print Word word Reference Up. Date Computer Science Dept Va Tech Aug. , 2001 Intro Data Structures & SE © 1995 -2001 Barnette ND, Mc. Quain WD