Perspective on Unusual Control Structures

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.

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

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