An Introduction to Computer Programming: Definitions
Copyright 2023 Brian Davis - CC-BY-NC-SA
Software Engineering shares a quality with law and philosophy. It is fundamentally concerned with translating the ambiguity of human expression into a precise language fit for the application of rational thought and the rules of logic. That is, our definitions are our tools and they must be sharp.
However, unlike law which is concerned with the myriad of human behavior, and unlike philosophy which is concerned with anything from the infinite cosmos to nothing at all, software engineers are concerned with a finite machine, the computer. Our universe is bounded by an enumerable and implacable set of rules. Thou shalt not exceed available memory. Thy processor shall execute so fast and no faster. Etc, etc. Computers are complex machines but they are entirely knowable.
Historically we have been mind boggling TERRIBLE at making useful definitions. Ask any N practitioners of the binary arts what a thread is and you will get, at a minimum, N definitions. With this glossary I have not set out to make a definitive dictionary, but rather, to collate my research on the de facto terms as they are used today and from that mire draw forth workable distinctions honed to sufficient precision for use. Unlike lawyers and philosophers, who need only sufficient specificity to convey their ideas to other humans, and may rely on the interpretive powers of their audience, even hide their rational short comings in ambiguity, we must communicate our ideas to our mechanical devices. The computer will never guess and neither must we.
A series of instructions for the computer, separate from the main routine and other subroutines. We say that the subroutine is called when the currently executing routine tells the computer to switch to executing the subroutine. When a subroutine finishes, the computer returns to place in the code where the subroutine was called. It can be said that a subroutine is a function that takes no arguments and returns no values.
A function is a subroutine that takes one or more arguments and may return one or more values. Most modern languages no longer have separate subroutines and functions, merely functions that may or may not take arguments or return values.
A coroutine is a function that may be started, stopped and resumed. The local state of the function, including the current instruction pointer and stack, are preserved when the coroutine is stopped.
A continuation is the necessary information for the computer to change its state of execution. This includes not only the instruction pointer but the current stack frame.