Structured and unstructured programming
Approaches to programming are often categorised as being either structured or unstructured.
Unstructured programming predates structured approaches, and can be found in languages such as BASIC, FORTRAN and machine code. It involves a single code block, and makes extensive use of GOTO in order to control the flow of the execution and add complexity to the program. As a result of this constant jumping around, unstructured code can become very difficult to follow and maintain – especially when it comes to larger projects. This also makes it much more difficult for multiple programmers to collaborate on the same code. Another noteworthy feature of unstructured programming is that there is only one (global) scope for variables; there is no concept of local variables.
In contrast, structured programming is modular in nature, making it considerably easier to follow and maintain. These approaches are common to the majority of modern programming languages. Rather than using GOTO to control the flow of execution, structured approaches make use of loops and the execution of smaller, nested blocks of code which can have their own locally-scoped variables. This improves readability and makes it easier to improve small parts of a program without having unintended effects in other areas. As a result, it is much easier for multiple programmers to collaborate by working separately on isolated parts of the code.
Comparing the two, it can be seen that structured approaches are superior for almost all purposes; they are easier to read and maintain, they are scalable (to very large projects), and can allow for the expression of rather complex solutions in a much simpler form.