Procedures, Parameters & Sub-programs

Procedures, Parameters & Sub-programs

Length: 1016 words (2.9 double-spaced pages)

Rating: Excellent

Open Document

Essay Preview

More ↓
Procedures, Parameters & Sub-Programs

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 of the program,
so long as the program contains more than one reference to the procedure!

Object programs require less memory. Procedures reduce the memory consumption
of the program in two ways. Firstly they reduce code duplication as the code
only needs to be stored once, but the procedure can be called many times.
Secondly, procedures allow more efficient storage of data, because storage for a
procedure's variables is allocated when the procedure is called and deallocated
when it returns.

We can divide procedures into two groups:-

Function procedures, are procedures which compute a single value and whose calls
appear in expressions

For example, the procedure ABS is a function procedure, when given a number x,
ABS computes the absolute value of x; a call of ABS appears in an expression,

How to Cite this Page

MLA Citation:
"Procedures, Parameters & Sub-programs." 123HelpMe.com. 28 Feb 2020
    <https://www.123helpme.com/view.asp?id=82419>.

Need Writing Help?

Get feedback on grammar, clarity, concision and logic instantly.

Check your paper »

The Poverty Of Sub Saharan Africa Essay

- The youth population in Sub-Saharan Africa is increasing rapidly. Nearly one in three people living in the region, or about 297 million, are between the ages of 10 and 24. The population of Sub-Saharan Africa has over 56 million people aged between 15 to 24, who have not yet completed primary school, and require many alternatives to be able to gain employment to survive. Youth unemployment remains a barrier to the region 's development. Some of the highest rates on the continent are in southern Africa, where 51% of young women and 43% of young men are unemployed (The World’s Youth, 2013)....   [tags: Africa, Education, Sub-Saharan Africa]

Research Papers
2222 words (6.3 pages)

Storage Procedures : Using Stored Procedures Essay

- What are stored Procedures Stored procedures are a set of SQL statements, compiled and stored as a single database object for repeated use and has various other advantages compared to the embedded SQL queries in the Graphical User Interface (GUI). The stored procedures are usually implemented by extending the SQL to the programming constructs (Branching and looping) enabling the developer to write the business logic in the stored procedures. The stored procedures are to be compiled just once and stored in the libraries which are ready to go and can be invoked at any time by the authorized programs....   [tags: SQL, Database management system, Business logic]

Research Papers
1072 words (3.1 pages)

Company X Ethics Program : Standards And Procedures Essay

- Company X Ethics Program Standards and Procedures Fitness for Duty Employees are expected to report to work and remain physically and mentally fit for duty in the workplace. Prescription drugs and over the counter medication that affects one 's ability to work safely needs to be communicated to the employee 's supervisor promptly. Safety Company X strives to maintain a safe and injury free workplace environment for it 's employees, customers, vendors, contractor and general public....   [tags: Employment, Ethics, Compliance and ethics program]

Research Papers
1036 words (3 pages)

Essay on South African and the International Politics in sub-Saharan Africa

- The global network of super powers has claimed many regions through human security, political actions, and economic development. One of the largest landscapes is that of sub-Saharan Africa, in which 50 plus countries make up the geographical landscape (Library of Congress, 2010). In consideration of the long history of changing powers and the colonization of the different countries by Dutch, French, and British influences giving up power after WWII; the prospect of democracy for the sub-Saharan African countries is an ongoing battle (Braithwaite, 2014)....   [tags: political change, south africa, sub-saharan]

Research Papers
1740 words (5 pages)

Essay on Physiological Parameters Of The Pulmonary Airflow

- In this experiment, several physiological parameters were observed in three patients before, during, and after moderate exercise. One of these parameters was the pulmonary airflow, which was recorded utilizing an Airflow Transducer. This device measures airflow using slight pressure differences created by the resistance of a screen inside the device. Pulmonary airflow is the rate of movement into and out of the lungs, and is directly proportional to the pressure difference of the intrapulmonary pressure and the atmospheric pressure, and inversely proportional to the resistance of the lungs (elasticity/diameter of air pathways).1 The BIOPAC program then can convert the airflow to volume of ai...   [tags: Heart, Muscle, Blood, Exercise physiology]

Research Papers
1037 words (3 pages)

Abortion Procedures in Abort73 Essay

- The American culture is addicted to and repulsed by graphic violence. Ratings soar on news stations when a mass murder occurs. People speak of how terrible it is, and yet, their eyes are fastened to the television set. The author, who will be referred to as ‘Abort73’, uses this disgust of mass death to support the idea that abortion and the procedures used, are evil. For many, abortion is a political issue only, not a moral issue of high importance. Like most political issues, it is clouded in partisan debates and logical fallacies....   [tags: procedures, fetus, advocates]

Research Papers
693 words (2 pages)

Comunity Risk Reduction Programs and Procedures Essay

- Introduction As emergency providers we are viewed as a trusted and valuable source of information particularly when it comes to protecting the public. Through the years the America Fire Service has recognized the need to build and maintain effective emergency response capabilities. The new norm for the fire service has many common similarities with financial restraints that affect staffing levels, response times, equipment needs, growing pressures from political groups, and various demographic considerations, yet the expectations to provide a high quality service are still present....   [tags: local fire department responsibilities]

Research Papers
1148 words (3.3 pages)

The Problem Of Sub Saharan Africa Essay

- Despite the improvements within the last decade the vast majority of sub-Saharan Africa remains corrupt. Corruption is a complex phenomenon. The inability for the country as a whole to solve their own issues is indeed the reason the country till this day is considered a developing nation. But as much as sub-Saharan is said to be ethical, stats and numbers illustrate many forms of corruption. Corruption within the country’s policies, bureaucratic traditions, political development, and social history....   [tags: Africa, Sub-Saharan Africa, Political corruption]

Research Papers
2249 words (6.4 pages)

The Abolition Of Colonialism On Sub Saharan Africa Essays

- Since 1960, the imposition of colonialism on sub-Saharan Africa has affected the continent in many ways. Pacifically political and economic development. Africa has gone through so much just to become an independent country. Going back 1870 when Belgians began to trade with Africans in the Congo. The other European countries began to worry about missing out on the many amazing raw materials Africa possessed. The most important factor that motivated European colonial expansion was economic gain. This is due to industrial revolution, which began in Britain in the second half of the eighteenth century....   [tags: Africa, Colonialism, Sub-Saharan Africa]

Research Papers
1210 words (3.5 pages)

Sub-Atomic Particles Essay

- Introduction In Ancient Greece, many believed that everything was made up of simple particles called Atoms. They called them Atoms because they believed that they had no parts and could not be broken. This had been believed for many centuries until evidence that something smaller actually existed (the electron). Once scientists found the electron, they were not satified. Scientists kept creating new theories and testing new hypothesis' attempting to find what makes the world tick. Now, the universe's fundimental particles have seemingly been found, but scientists are still searching for a more complete answer....   [tags: Physics Science Sub Atomic Particle]

Free Essays
878 words (2.5 pages)

Related Searches

representing the value that ABS computes.

Proper procedures, are procedures whose calls are statements

For example, the procedure INC is a proper procedure. A call of INC is a
statement; executing INC changes the value stored in a variable.

Procedures have only one real disadvantage: Executing a procedure requires
extra time because of the extra work that must be done both when the procedure
is called, and when it returns.

Most of the time however, the advantages of using procedures heavily outweigh
this minor disadvantage.

Most procedures depend on data that varies from one call to the next, and for
this reason, Modula-2 allows a procedure heading to include a list of
identifiers that represent variables or expressions to supply when calling the
procedure. The programmer can use these identifiers, known as formal
parameters, in the body of the procedure in the same fashion as ordinary
variables.

A call of a procedure with parameters must include a list of actual parameters.
The number of actual parameters must be the same as the number of formal
parameters. Correspondence between the actual and formal parameters is by
position, so the first actual parameter corresponds to the first formal
parameter, the second actual parameter corresponds to the second formal
parameter, and so on. The type of each actual parameter must match the type of
the corresponding formal parameter.

Modula-2 provides to kinds of formal parameters:-

Variable parameters. In a procedure heading, if the reserved word VAR precedes
a formal parameter, then it is a variable parameter. Any changes made to a
variable parameter within the body of the procedure also affect the
corresponding actual parameter in the main body of the program.

Value parameters. If the reserved word VAR does not precede a formal parameter
then it is a value parameter. If a formal parameter is a value parameter, the
corresponding actual parameter is protected from change, no matter what changes
are made to the corresponding parameter in the procedure.

To sum up, variable parameters allow information to flow both into and/or out of
a procedure, whereas value parameters are one way and only allow information
into a procedure.

Most Modula-2 systems allow a program to "call" a program module as if it were a
procedure. We call a module used in this way a subprogram module or just a
subprogram. The commands for calling another program are not part of Modula-2
itself, but are provided by a procedure in a library module. The command used
in most Modula-2 systems for calling a sub-program is CALL, and a number of
parameters are usually passed along with this procedure so as to allow the two
programs to communicate with each other, but there is no way to supply
parameters to a subprogram. The parameters passed only indicate things like
whether the sub-program was executed correctly and did not terminate early
because of an error.

The primary reason for using subprograms is to reduce the amount of memory
required to execute a program. If a program is too large to fit into memory,
the programmer can often identify one or more modules, that need not exist
simultaneously. The main module can then call these modules as subprograms when
needed. Once a subprogram has completed execution, it returns control to the
main program, which can then call another sub program. All subprograms share
the same area of memory, and because only one is resident at a time, the memory
requirements of the overall program are greatly reduced.
Return to 123HelpMe.com