17.4. Perspective on Unusual Control Structures

 < Free Open Study > 

At one time or another, someone thought that each of the following control structures was a good idea:

  • Unrestricted use of gotos

  • Ability to compute a goto target dynamically and jump to the computed location

  • Ability to use goto to jump from the middle of one routine into the middle of another routine

  • Ability to call a routine with a line number or label that allowed execution to begin somewhere in the middle of the routine

  • Ability to have the program generate code on the fly and then execute the code it just wrote

At one time, each of these ideas was regarded as acceptable or even desirable, even though now they all look hopelessly quaint, outdated, or dangerous. The field of software development has advanced largely through restricting what programmers can do with their code. Consequently, I view unconventional control structures with strong skepticism. I suspect that the majority of constructs in this chapter will eventually find their way onto the programmer's scrap heap along with computed goto labels, variable routine entry points, self-modifying code, and other structures that favored flexibility and convenience over structure and the ability to manage complexity.

 < Free Open Study > 


Code Complete
Code Complete: A Practical Handbook of Software Construction, Second Edition
ISBN: 0735619670
EAN: 2147483647
Year: 2003
Pages: 334

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net