Non-structured programming
Non-structured programming is the historically earliest programming paradigm capable of creating Turing-complete algorithms. It is often contrasted with structured programming paradigms, including procedural, functional, and object-oriented programming.
Unstructured programming has been heavily criticized for producing hardly-readable ("spaghetti") code and is sometimes considered a bad approach for creating major projects, but has been praised for the freedom it offers to programmers and has been compared to how Mozart wrote music.[1]
There are both high- and low-level programming languages that use non-structured programming. Some languages commonly cited as being non-structured include JOSS, FOCAL, TELCOMP, assembly languages, MS-DOS batch files, and early versions of BASIC, Fortran, COBOL, and MUMPS.
Features and typical concepts
Basic concepts
A program in a non-structured language usually consists of sequentially ordered commands, or statements, usually one in each line. The lines are usually numbered or may have labels: this allows the flow of execution to jump to any line in the program.
Non-structured programming introduces basic control flow concepts such as loops, branches and jumps. Although there is no concept of procedures in the non-structured paradigm, subroutines are allowed. Unlike a procedure, a subroutine may have several entry and exit points, and a direct jump into or out of subroutine is (theoretically) allowed. This flexibility allows realization of coroutines.
There is no concept of locally scoped variables in non-structured programming (although for assembly programs, general purpose registers may serve the same purpose after saving on entry), but labels and variables can have a limited area of effect (for example, a group of lines). This means there is no (automatic) context refresh when calling a subroutine, so all variables might retain their values from the previous call. This makes general recursion difficult, but some cases of recursion—where no subroutine state values are needed after the recursive call—are possible if variables dedicated to the recursive subroutine are explicitly cleared (or re-initialized to their original value) on entry to the subroutine. The depth of nesting also may be limited to one or two levels.
Data types
Non-structured languages allow only basic data types, such as numbers, strings and arrays (numbered sets of variables of the same type). The introduction of arrays into non-structured languages was a notable step forward, making stream data processing possible despite the lack of structured data types.
References
- ↑ William W. Cobern. A positive albeit ambiguous case for BASIC programming in secondary science teaching.
Further reading
- Cobb, Gary W. (1978). "A measurement of structure for unstructured programming languages". ACM SIGSOFT Software Engineering Notes. 3 (5): 140–147. ISSN 0163-5948. doi:10.1145/953579.811114.
External links
The Wikibook Computer Programming has a page on the topic of: Control |
- BPStruct - A tool to structure concurrent systems (programs, process models)