Structural Equivalent
The JSP version of the program is structurally equivalent to
String line; line = in.readLine; while (line != null) { int count = 0; String firstLineOfGroup = line; while (line != null && line.equals(firstLineOfGroup)) { count++; line = in.readLine; } System.out.println(firstLineOfGroup + " " + count); }and the traditional version of the program is equivalent to
String line; int count = 0; String firstLineOfGroup = null; while ((line = in.readLine) != null) { if (firstLineOfGroup == null || !line.equals(firstLineOfGroup)) { if (firstLineOfGroup != null) { System.out.println(firstLineOfGroup + " " + count); } count = 0; firstLineOfGroup = line; } count++; } if (firstLineOfGroup != null) { System.out.println(firstLineOfGroup + " " + count); }Jackson criticises the traditional version, claiming that it hides the relationships which exist between the input lines, compromising the program's understandability and maintainability by, for example, forcing the use of a special case for the first line and forcing another special case for a final output operation.
Read more about this topic: Jackson Structured Programming
Famous quotes containing the words structural and/or equivalent:
“The reader uses his eyes as well as or instead of his ears and is in every way encouraged to take a more abstract view of the language he sees. The written or printed sentence lends itself to structural analysis as the spoken does not because the readers eye can play back and forth over the words, giving him time to divide the sentence into visually appreciated parts and to reflect on the grammatical function.”
—J. David Bolter (b. 1951)
“To place oneself in the position of God is painful: being God is equivalent to being tortured. For being God means that one is in harmony with all that is, including the worst. The existence of the worst evils is unimaginable unless God willed them.”
—Georges Bataille (18971962)