Subroutine - Research Article from World of Computer Science

This encyclopedia article consists of approximately 2 pages of information about Subroutine.
Encyclopedia Article

Subroutine - Research Article from World of Computer Science

This encyclopedia article consists of approximately 2 pages of information about Subroutine.
This section contains 301 words
(approx. 2 pages at 300 words per page)

A subroutine, which can also be commonly called a routine, is a section of a computer program that performs a particular task. Subroutines are sets of computer instructions that exist and run within a program.

Computer programs can be written as a single document. However, this format can be cumbersome when checking for programming defects. Accordingly, many programs are now written in more easily managed sections. Each of these sections, which can also be termed a module (or modulus), is made up of one or more subroutines/routines. The concerted performance of the various tasks specified by the subroutines enables the program to function.

Subroutines can be used repeatedly during the execution of a program. This makes a program shorter and easier to write, as redundant sections are eliminated. A subroutine can be invoked during the running of a program and, when finished, that subroutine can branch back to the next instruction following the one that branched to it.

Subroutines are often parts of computational programs. Following a prompted format, the user inputs data (for example, a number specifying a temperature in degrees Celsius) the program then immediately accesses a conversion subroutine to add 273.15 to the number to convert the number to the Kelvin scale) the use of the input and conversion subroutine saves many programming lines that would otherwise be dedicated to performing this repetitious task for separate data entry items. Branching to subroutines also permits programs to directly access needed programming steps without having to run through unneeded code.

A subroutine may also be useful in more than one program and a subroutine code may be capable of being shared by multiple programs. Subroutines may also be packaged together with an interface to allow their use for a specific function such as those exemplified by Library routines.

This section contains 301 words
(approx. 2 pages at 300 words per page)
Copyrights
Gale
Subroutine from Gale. ©2005-2006 Thomson Gale, a part of the Thomson Corporation. All rights reserved.