Sunday, June 2, 2019
Procedures, Parameters & Sub-programs :: essays research papers
Procedures, Parameters & Sub-ProgramsIn any modern syllabusming language, procedures play a vital role in theconstruction of any new softw ar. These days, procedures are workd instead ofthe old constructs of GOTO and GOSUB, which have since become obsolete.Procedures provide a number of important features for the modern softwareengineer-Programs are easier to write. Procedures save a large amount of time duringsoftware development as the programmer only needs to code a procedure once, butcan utilise it a number of times. Procedures are especially useful in recursivealgorithms 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 anumber of much smaller parts, each accomplished by a procedure. Procedures alsoprovide a form of abstraction as all the programmer has to do is know how tocall a procedure and what it does, not how it accomplishes the task.Programs are easier to read. Procedures sponsor to make programs shorter, and thuseasier to read, by replacing long sequences of statements with one simpleprocedure call. By choosing goo procedure names, even the names of theprocedures help to document the program and make it easier to understand.Programs are easier to modify. When repeated actions are replaced by oneprocedure call, it becomes much easier to modify the code at a by and by stage, andalso correct any errors. By building up the program in a modular fashion viaprocedures it becomes much easier to update and replace sections of the programat a later date, if all the code for the specific section is in a particularmodule.Programs take less time to compile. Replacing a sequence of statements withonce simple procedure call usually reduces the compilation time of the program,so long as the program contains more than one reference point to the procedureObject programs require less memory. Procedures reduce the memory consumptionof the program in two ways. Firstl y they reduce code duplication as the codeonly needs to be stored once, but the procedure can be called many times.Secondly, procedures allow more efficient storage of data, because storage for aprocedures variables is allocated when the procedure is called and deallocatedwhen it returns.We can divide procedures into two groups-Function procedures, are procedures which compute a single value and whose callsappear in expressionsFor example, the procedure ABS is a service procedure, when given a number x,ABS computes the absolute value of x a call of ABS appears in an expression,
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.