New version!A new version of this website is available at architectural-patterns.net. Call and Return a.k.a. Main program And Subroutines
This control flow is a classic. In so called imperative programming languages, like C, Pascal, Java, C++, etc. it is so pervasive, it takes time to get used to the idea that other control flows exist. The control flow is a hierarchy of function (or subroutine) calls. When the super function calls a sub function, control is transferred to the sub function. When the function finishes, it returns control to the super function. This control is always to be preferred. Don't use anything else unless you have a darned good reason for it. It is simple, intuitive (for a programmer), and debugging is a breeze. Command structure: Control Tree; Order of execution: Sequential. |