Additional Resources

cc2e.com/1792

The following resources also address unusual control structures:

Returns

Fowler, Martin. Refactoring: Improving the Design of Existing Code. Reading, MA: Addison-Wesley, 1999. In the description of the refactoring called "Replace Nested Conditional with Guard Clauses," Fowler suggests using multiple return statements from a routine to reduce nesting in a set of if statements. Fowler argues that multiple returns are an appropriate means of achieving greater clarity, and that no harm arises from having multiple returns from a routine.

gotos

cc2e.com/1799

These articles contain the whole goto debate. It erupts from time to time in most work-places, textbooks, and magazines, but you won't hear anything that wasn't fully explored 20 years ago.

Dijkstra, Edsger. "Go To Statement Considered Harmful." Communications of the ACM 11, no. 3 (March 1968): 147–48, also available from http://www.cs.utexas.edu/users/EWD/. This is the famous letter in which Dijkstra put the match to the paper and ignited one of the longest-running controversies in software development.

Wulf, W. A. "A Case Against the GOTO." Proceedings of the 25th National ACM Conference, August 1972: 791–97. This paper was another argument against the indiscriminate use of gotos. Wulf argued that if programming languages provided adequate control structures, gotos would become largely unnecessary. Since 1972, when the paper was written, languages such as C++, Java, and Visual Basic have proven Wulf correct.

Knuth, Donald. "Structured Programming with go to Statements," 1974. In Classics in Software Engineering, edited by Edward Yourdon. Englewood Cliffs, NJ: Yourdon Press, 1979. This long paper isn't entirely about gotos, but it includes a horde of code examples that are made more efficient by eliminating gotos and another horde of code examples that are made more efficient by adding gotos.

Rubin, Frank. "‘GOTO Considered Harmful’ Considered Harmful." Communications of the ACM 30, no. 3 (March 1987): 195–96. In this rather hotheaded letter to the editor, Rubin asserts that goto-less programming has cost businesses "hundreds of millions of dollars." He then offers a short code fragment that uses a goto and argues that it's superior to goto-less alternatives.

The response that Rubin's letter generated was more interesting than the letter itself. For five months, Communications of the ACM (CACM) published letters that offered different versions of Rubin's original seven-line program. The letters were evenly divided between those defending gotos and those castigating them. Readers suggested roughly 17 different rewrites, and the rewritten code fully covered the spectrum of approaches to avoiding gotos. The editor of CACM noted that the letter had generated more response by far than any other issue ever considered in the pages of CACM.

For the follow-up letters, see

  • Communications of the ACM 30, no. 5 (May 1987): 351–55.

  • Communications of the ACM 30, no. 6 (June 1987): 475–78.

  • Communications of the ACM 30, no. 7 (July 1987): 632–34.

  • Communications of the ACM 30, no. 8 (August 1987): 659–62.

  • Communications of the ACM 30, no. 12 (December 1987): 997, 1085.

cc2e.com/1706

Clark, R. Lawrence, "A Linguistic Contribution of GOTO-less Programming," Datamation, December 1973. This classic paper humorously argues for replacing the "go to" statement with the "come from" statement. It was also reprinted in the April 1974 edition of Communications of the ACM.

cc2e.com/1713

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.232.189