Content deleted Content added
→Structural equivalent: switched the locations of the code, and explained PROPERLY what Jackson's example illustrated. Fixed an infelicity in the JSP C code. |
m →Structural equivalent: removed the section break, which made absolutely no sense |
||
Line 9:
At the time that JSP was developed, programs typically treated an input file as a sequence of records, so that all programs had the same structure— a single main loop that processed all of the records in the file, one at a time. Jackson asserted that this program structure was almost always wrong, and encouraged programmers to look for more complex data structures. In Chapter 3 of ''Principles of Program Design''<ref name="PoPD"/> Jackson presents two versions of a program, one designed using JSP, the other using the traditional single-loop structure.
Consider the following (Java) program. Its purpose is to recognize groups of repeated records (lines) in a sorted file, and to produce an output file listing each record and the number of times that it occurs in the file. It follows the traditional structure in having a single loop that processes the records one at a time.
|