If you want to get a bunch of programmers cooking, say something like this: Anyone who uses GOTOs ought to be fired, or The RPG cycle should be banned. Im going to throw in another condiment of the same flavor and say, Subroutines should be consigned to history. Let me first say that I plan to stand well clear of the discussions that will no doubt ensueI like to leave myself room to backtrack. The only absolute I adhere to is Keep the customer satisfied. But, just for the record, I havent used a GOTO in many years, Ive almost forgotten how the cycle works, and the last time I coded a BEGSR was over two years ago when V3R6 first delivered the prototyped subprocedure.
Now, allow me to divulge some thoughts on what kinds of programs keep customers happy. Theyre the programs you said would be ready with that new mod by Monday, and they are. They go right to work from the day you ship them and dont come back for rework. When you assign the job of maintaining them to a programmer, there is no hint of fear on his face. They are programs that offer some little improvement the customer didnt ask for but got anyhow.
In my view, none of these positive elements are possible with programs that are difficult to read, difficult to understand, difficult to test. With most programmers working directly off of screens, certain conditions should be met: Blocks of logic should span no more than a few screen loads. Logic should be structured (and names given) in such a way that it is understood with the least necessary effort. If anything goes wrong, the malfunctioning code should be easy to isolate and correct. And, most important, as a programs task becomes more complex, its internal structure must become more simple (you can get away with all sorts of poor structure and ill-conceived assumptions when your task is minor).
Compare subroutines to subprocedures with these requirements in mind, and theres no contest. Subprocedures have local variables; defined physically near to where they are used; and no matter what you call them, they are unique to that specific subprocedure. Subroutines can use only global variables. Subprocedures have formal interfaces; subroutines dont. Subprocedures can call themselves recursively; subroutines
MC Press Online