大象传媒

Implementation (computational constructs)Sub-programs

Computational constructs dictate how a source code is structured. Parameter passing, sub-programs, procedures and functions are critical constructs that allow for the development of good software.

Part of Computing ScienceSoftware design and development

Sub-programs

The terms sub-program, subroutine, procedure, method and function are used by computer scientists to describe a clear independent block of code within a program.

Each block can be reused if necessary, either within the same program or as part of a module within a module library. Sometimes the terms can become confusing, especially as they can appear to be used interchangeably or in similar contexts.

The terms sub-program and subroutine are fairly generic and simply describe the fact that there is an independent block of code that can be called upon, re-used or accessed by the main program.

When a main program 鈥榗alls鈥 a sub-program it will run the code contained within the sub-program.

Related links