Main program and subroutine is a style that is fundamentally focused on functions. When presented with a system to model, you break up the overall functionality of the system into a main program and subroutines.
In the diagram, we can see how subroutines are connected by procedure calls, and may even have nested calls:
The structure of the resulting code is not flat, it’s hierarchical, hence it can be modeled as a directed graph. The subroutines, as declared in the code are structured as a big call tree. As OO languages, procedural programming supports abstract data types, but inheritance is not explicitly supported. It’s not easy to make one abstraction type an extension of another type. Here, the main consideration is the behavior of functions and how data moves through them. As a result, this approach is suitable for computation-focused systems.
Continue reading “Main Program and Subroutine”