Nassi-Shneiderman charts

Nassi-Shneiderman charts

56.1 Purpose

Nassi-Shneiderman charts were developed by Nassi and Shneiderman as an alternative to traditional logic flowcharts. Their intent was to provide a structured, hierarchical, graphical view of the flow of logic through a program, a routine, a module, or a process. Nassi-Shneiderman charts are used to document, plan, and design detailed program logic.

56.2 Strengths, weaknesses, and limitations

A properly prepared Nassi-Shneiderman chart can illustrate the flow of logic through a module or routine at a glance. Nassi-Shneiderman charts are useful for describing or planning relatively small modules, routines, or processes. They can be used to clearly show nesting and recursion, and are easily converted to structured code.

Nassi-Shneiderman charts should not be used for documenting complete programs or large routines. As a general rule, Nassi-Shneiderman charts should be limited to a single page with no more than 20 subdivisions. For larger routines, combine several steps to form a subroutine, link to the subroutine, and independently chart the subroutine.

Traditional logic flowcharts (Chapter 55) are more familiar to most users and information system professionals. 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. Hierarchy charts (Chapter 62) or structure charts (Chapter 63) are better choices for describing or planning the overall logical structure of a program.

56.3 Inputs and related ideas

Before creating a Nassi-Shneiderman chart, 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 problem definition (Part II) and/or analysis (Part IV) stages of the system development life cycle.

Other tools for documenting or planning routines or processes include logic flowcharts (Chapter 55), 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 usually exists in the context of a larger program. Tools for documenting or planning program structure include structure charts (Chapter 63) and HIPO (Chapter 64).

56.4 Concepts

A Nassi-Shneiderman chart describes within a single rectangular box the flow of logic through a module or a routine. Control enters at the top, drops through the box, and exits at the bottom, yielding a single entry point and a single exit point. No branch instructions are permitted.

56.4.1 Program logic

Within a Nassi-Shneiderman chart, sequential, selection, and repetitive logic (Chapter 62) are shown as a set of stacked, horizontal subdivisions. Each sequence logic step occupies a single subdivision or line (Figure 56.1). Note that a sequential logic block might represent one or more actual instructions or a reference to a subroutine.

56-01
Figure 56.1  Sequence logic.

A selection (or decision) block implies IF/THEN/ELSE logic (Figure 56.2) and is documented in two parts. The top part is divided into three triangles showing, the condition (top), the path to be taken if the condition is true (left), and the path to be taken if the condition is false (right). The THEN logic is entered below the “true” triangle, and the ELSE logic is entered below the “false” triangle. Nested selection logic is documented by showing another IF/THEN/ELSE block on the appropriate path (Figure 56.3). Case structures (Figure 56.4) are documented by showing a separate path for each case.

There are two patterns for showing repetitive logic: DO WHILE and DO UNTIL (Figure 56.5). 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.

56-02
Figure 56.2  Selection logic.

56-03
Figure 56.3  Nested selection logic.

56-04
Figure 56.4  A case structure.

56-05
Figure 56.5  Repetitive logic.

56.4.2 Some examples

Figure 56.6 shows a Nassi-Shneiderman chart for computing an average. Figure 56.7 shows a Nassi-Shneiderman chart for a routine that accepts a transaction and, based on the transaction type, calls another routine that adds, deletes, or modifies a record.

56-06
Figure 56.6  A Nassi-Shneiderman chart for computing an arithmetic average.

56-07
Figure 56.7  A data maintenance routine.

56.5 Key terms
Module —
A portion of a larger program that performs a specific task.
Nassi-Shneiderman chart —
An alternative to traditional logic flowcharts that provides a structured, hierarchical, graphical view of the flow of logic through a program, a routine, a module, or a process.
Process —
A set of steps for performing a task.
Routine —
A set of instructions that performs a specific, limited task.
56.6 Software

The examples in this chapter were prepared using Visio. Other charting programs (such as Micrografx’s Flowcharter) can also be used.

56.7 References
1.  Martin, J. and McClure, C., Diagramming Techniques for Analysts and Programmers, Prentice-Hall, Englewood Cliffs, NJ, 1985.
2.  Nassi, I. and Shneiderman, B., Flowchart techniques for structured programming, ACM SIGPLAN Notices, 8(8), 12, 1973.

Comments

Popular posts from this blog

The Conversion Cycle:The Traditional Manufacturing Environment

The Revenue Cycle:Manual Systems