Procedures, Parameters & Sub-Programs

Essay by Anonymous UserCollege, UndergraduateB+, January 1995

download word file, 4 pages 4.3

In any modern programming language, procedures play a vital role in the construction of any new software. These days, procedures are used instead of the old constructs of GOTO and GOSUB, which have since become obsolete.

Procedures provide a number of important features for the modern software engineer:-

Programs are easier to write. Procedures save a large amount of time during software development as the programmer only needs to code a procedure once, but can use it a number of times. Procedures are especially useful in recursive algorithms where the same piece of code has to be executed over and over again. The use of procedures allows a large and complex program to be broken up into a number of much smaller parts, each accomplished by a procedure. Procedures also provide a form of abstraction as all the programmer has to do is know how to call a procedure and what it does, not how it accomplishes the task.

Programs are easier to read. Procedures help to make programs shorter, and thus easier to read, by replacing long sequences of statements with one simple procedure call. By choosing goo procedure names, even the names of the procedures help to document the program and make it easier to understand.

Programs are easier to modify. When repeated actions are replaced by one procedure call, it becomes much easier to modify the code at a later stage, and also correct any errors. By building up the program in a modular fashion via procedures it becomes much easier to update and replace sections of the program at a later date, if all the code for the specific section is in a particular module.

Programs take less time to compile. Replacing a sequence of statements with once simple procedure call usually reduces the compilation time...