subroutine

subroutine

UK[ˌsʌbruːˈtiːn]US[ˈsʌbruːˌtiːn]
n

A set of instructions for performing a specific task within a larger computer program, which can be called upon when needed.

Morpheme Breakdown

sub
routine
sub

under, secondary

routine

regular procedure

Etymology

The term 'subroutine' is a modern compound from the field of computer science, coined in the mid-20th century. It logically combines the Latin prefix 'sub-', implying a subordinate or secondary level, with the word 'routine', denoting a fixed sequence of operations. The concept is that a subroutine is a secondary, self-contained routine that operates under the control of a main program. This construction perfectly captures the functional hierarchy in programming, where a main procedure delegates specific, repeatable tasks to these subordinate blocks of code.

Analysis

Structure: sub (under, secondary) + routine (regular procedure) - sub: A prefix of Latin origin, meaning "under," "below," or "secondary." - routine: A noun of French origin (via route, from Latin rupta 'broken way'), meaning a regular course of procedure or a standard set of instructions.

Examples

The programmer created a subroutine to handle all error-checking logic.

Calling a subroutine temporarily transfers control from the main program.

Efficient code often reuses subroutines to avoid repetition.