Logic (process) flowcharts
Logic (process) flowcharts
55.1 Purpose
A logic or process flowchart is a graphical representation of the flow of logic, control, data, or paperwork through a program, a routine, a module, or a process. The flowchart specifies or documents the order in which tasks are performed. Flowcharts are used for documentation and for planning.
55.2 Strengths, weaknesses, and limitations
A properly prepared flowchart can illustrate logical flow at a glance. Flowcharts are useful for describing or planning the logical flow through a relatively small module, routine, or process. A flowchart is a good choice for describing or planning a decision-based algorithm where the number of alternative paths does not exceed three.
Logic flowcharts should not be used for documenting complete programs or large routines. Flowcharts extending over multiple pages are difficult to follow, and flowcharts (of any size) are difficult to maintain. If a flowchart spills beyond a single page (or a single screen), combine several steps to form a subroutine (or predefined process), link to the subroutine from the primary routine, and independently flowchart the subroutine.
Algebra, pseudocode (Chapter 59), and structured English (Chapter 60) may be better choices for describing or planning algebraic algorithms with no decisions. Decision trees (Chapter 57) and decision tables (Chapter 58) may be better for describing or planning complex case structures. Nassi-Shneiderman charts (Chapter 56) are better for planning and documenting structured program logic. Hierarchy charts (Chapter 62) or structure charts (Chapter 63) are better choices for describing or planning the overall logical structure of a program.
55.3 Inputs and related ideas
Before creating a logic or process flowchart, the designer must understand the algorithm or procedure. The necessary information might be compiled from direct observation, extracted from existing documentation, or derived from the information gathered during the problem definition (Part II) and/or systems analysis (Part IV) stages of the system development life cycle.
Other tools for documenting or planning routines or processes include Nassi-Shneiderman charts (Chapter 56), decision trees (Chapter 57), decision tables (Chapter 58), pseudocode (Chapter 59), structured English (Chapter 60), and input/process/output (IPO) charts (Chapter 64). A routine often exists in the context of a larger program. Tools for documenting or planning program structure include structure charts (Chapter 63) and HIPO (Chapter 64).
Logic flowcharts are sometimes confused with system flowcharts (Chapter 37). A system flowchart documents the physical relationships between a system’s physical components. A logic flowchart shows the flow of logic, control, or data through a routine or a procedure.
55.4 Concepts
A logic or process flowchart uses seven standard symbols (Figure 55.1). A terminator marks the beginning or end of the flowchart. A process symbol indicates an operation that changes or manipulates data in some way (e.g., arithmetic, move, or copy). A data symbol (a parallelogram) indicates an operation that inputs or outputs data. A diamond indicates a decision. A connector (a small circle) means that the logic is continued at another place on the same page. An off-page connector (home plate) indicates that the logic is continued on another page. A rectangle within a rectangle indicates a predefined process (or subroutine).
Figure 55.1 Standard flowcharting symbols.
The symbols are linked by flowlines that show the sequence and direction of flow. By convention, logic flows from the top down and from left to right, and arrowheads are added to the flowlines to indicate deviations from this standard pattern. Arrowheads make a flowchart easier to read even when the direction of flow follows convention.
55.4.1 Program logic
Flowcharts with multiple entry or exit points are difficult to follow and can easily be misinterpreted. As a general rule, each routine or process should have a single entry point and a single exit point.
Program logic can be expressed as combinations of three basic patterns: sequence, decision, and repetition (Chapter 62). A program is composed of combinations of these three basic structures.
The sequence pattern (Figure 55.2) implies that the logic is executed in simple sequence, one block after another. Note that each block might represent one or more actual instructions.
A decision block implies IF-THEN-ELSE logic (Figure 55.3). A condition (the diamond symbol) is tested. If the condition is true, the logic associated with the THEN branch is executed and the ELSE block is skipped. If the condition is false the ELSE logic is executed and the THEN logic is skipped. Note that the THEN and ELSE blocks might represent one or more actual instructions. Note also that a given THEN or ELSE block might incorporate an additional decision block, yielding nested decision logic.
There are two basic patterns for showing repetitive logic: DO WHILE and DO UNTIL (Figure 55.4). In a DO WHILE block, the test is performed first and the associated instructions are performed only if (while) the test condition is true. In a DO UNTIL block, the associated instructions are executed first and then the exit condition is tested. Note that the logic block associated with a DO WHILE or DO UNTIL might represent one or more actual instructions.
55.4.2 A module flowchart
Figure 55.5 shows a flowchart for computing an average. It begins with sequential logic to initialize a counter and an accumulator and to read the first data value. (Technically, additional logic should be added to this flowchart to ensure that the initial value of X is not negative.) The loop counts and accumulates values of X while X is greater than or equal to zero. The program ends by computing the average and outputting the results.
55.4.3 Predefined processes
Logic flowcharts extending over multiple pages are difficult to follow. If a flowchart spills beyond a single page (or a single screen), combine several steps to form a subroutine (or predefined process), link to the subroutine from the primary routine, and independently flowchart the subroutine.
For example, Figure 55.6 shows a flowchart for a routine that accepts a transaction and, based on the transaction type calls another routine that adds, deletes, or modifies a record. The predefined process symbols indicate that the detailed logic is flowcharted elsewhere. In effect, using predefined processes allows the designer to decompose the logic.
55.4.4 A process flowchart
Figure 55.7 shows a flowchart for performing a manual procedure: waiting on a customer in a retail store. Note how the logical flow guides the sales clerk’s actions. Once again, the predefined processes indicate subprocesses that are flowcharted in more detail elsewhere.
55.4.5 Connectors
Crossing flowlines are very difficult to follow and can easily be misinterpreted. To eliminate crossing flowlines, move one or more symbols or use an on-page connector. Generally, on-page connectors are shown in numbered pairs. For example, if the logic flows into a small circle marked 3, look for another small circle marked 3 with a flowline that rejoins the flowchart at some other point.
Off-page connectors are used when the logic is continued on another page or another screen. If a flowchart requires multiple off-page connectors, the flowchart is probably too big. One possible solution is to group some of the logic into one or more predefined processes and reduce the number of symbols on the page. Perhaps a better option is to consider using a different tool.
Figure 55.5 A flowchart for computing an arithmetic average.
Figure 55.6 A data maintenance routine.
55.5 Key terms
- Connector —
- A flowcharting symbol that indicates that the logic is continued at another place on the same page.
- Data symbol —
- A flowcharting symbol that indicates the input or output of data.
- Decision —
- A point in a program where the logical path is determined by a run-time condition.
- Flowline —
- On a flowchart, a line, often terminating in an arrowhead, that indicates the sequence and direction of flow between two symbols.
Figure 55.7 A flowchart for a manual procedure.
- Logic flowchart (process flowchart) —
- A graphical representation of the flow of logic, control, data, or paperwork through a program, a routine, a module, or a process.
- Module —
- A portion of a larger program that performs a specific task.
- Off-page connector —
- A flowcharting symbol that indicates that the logic is continued on another page.
- Predefined process —
- A flowcharting symbol that indicates that the logic is flowcharted in more detail elsewhere.
- Procedure —
- Guidelines, rules, and instructions that tell people how to perform a task; often, a manual procedure.
- Process —
- A set of steps for performing a task.
- Process symbol —
- A flowcharting symbol that indicates an operation that changes or manipulates data in some way.
- Routine —
- A set of instructions that performs a specific, limited task.
- Terminator —
- A flowcharting symbol that marks the beginning or end of the flowchart.
55.6 Software
ABC Flowcharter (Micrografx.), allCLEAR (SPSS), and Visio (Visio Corporation) are three popular flowcharting programs. The examples in this chapter were created using Visio.
55.7 References
- 1. Bohl, M., Flowcharting Techniques, SRA, Chicago, 1971.
- 2. Boillot, M. H., Gleason, G. M., and Horn, L. W., Essentials of Flowcharting, 5th ed., Business and Educational Technology, Dubuque, IA, 1995.
- 3. Chapin, N., Flowcharts, Auerbach, Princeton, NJ, 1971.
- 4. Davis, W. S., Business Systems Analysis and Design, Wadsworth, Belmont, CA, 1994.
- 5. Davis, W. S., Systems Analysis and Design: A Structured Approach, Addison-Wesley, Reading, MA, 1983.
- 6. Silver, G. A. and Silver, J. B., Computer Algorithms and Flowcharting, McGraw-Hill, New York, 1975.
Comments
Post a Comment