Subroutine

In computer programming, a subroutine is a sequence of program instructions that performs a specific task, packaged as a unit. This unit can then be used in programs wherever that particular task should be performed.
Subroutines may be defined within programs, or separately in libraries that can be used by many programs. In different programming languages, a subroutine may be called a routine, subprogram, function, method, or procedure. Technically, these terms all have different definitions. The generic, umbrella term callable unit is sometimes used.The name subprogram suggests a subroutine behaves in much the same way as a computer program that is used as one step in a larger program or another subprogram. A subroutine is often coded so that it can be started several times and from several places during one execution of the program, including from other subroutines, and then branch back (return) to the next instruction after the call, once the subroutine's task is done. The idea of a subroutine was initially conceived by John Mauchly during his work on ENIAC, and recorded in a January 1947 Harvard symposium on "Preparation of Problems for EDVAC-type Machines". Maurice Wilkes, David Wheeler, and Stanley Gill are generally credited with the formal invention of this concept, which they termed a closed subroutine, contrasted with an open subroutine or macro. However, Turing had discussed subroutines in a paper of 1945 on design proposals for the NPL ACE, going so far as to invent the concept of a return address stack.Subroutines are a powerful programming tool, and the syntax of many programming languages includes support for writing and using them. Judicious use of subroutines (for example, through the structured programming approach) will often substantially reduce the cost of developing and maintaining a large program, while increasing its quality and reliability. Subroutines, often collected into libraries, are an important mechanism for sharing and trading software. The discipline of object-oriented programming is based on objects and methods (which are subroutines attached to these objects or object classes).
In the compiling method called threaded code, the executable program is basically a sequence of subroutine calls.

View More On Wikipedia.org
  • 32

    Greg Bernhardt

    A PF Singularity From USA
    • Messages
      19,451
    • Media
      227
    • Reaction score
      10,043
    • Points
      1,237
  • 1

    Khairul Afifi

    A PF Quark
    • Messages
      2
    • Reaction score
      0
    • Points
      1
  • 1

    ecastro

    A PF Molecule From Philippines
    • Messages
      254
    • Reaction score
      8
    • Points
      76
  • 1

    dilasluis

    A PF Atom
    • Messages
      32
    • Reaction score
      0
    • Points
      31
  • 1

    pilipili2021

    A PF Quark
    • Messages
      5
    • Reaction score
      0
    • Points
      1
  • Back
    Top