Flow ChartsThe Flow Charts provide visualization of the control flow, or program logic, occurring inside the functions in your software. For complex functions that may consist of hundreds of lines of source code, these diagrams can help you more quickly grasp the internal logic of the routine.
A Flow Chart diagram presents the complete internal logic, of a single function at a time. For the next level higher level of abstraction - multiple functions but with reduced internal logic - use the Sequence Diagrams.
Display / Layout
There are four layout alternatives to choose from. Each is optimized to show a different aspect of the program logic and control structure of a function. Further options under the Display menu control additional aspects of the detail presented in the diagrams.
For illustration, consider this source code (right):
Within a given layout, you control how much detail is displayed. In the diagram shown, the generally diamond-shaped decision symbols contain the source code for the decision. An alternative setting reduces the contents to just the name of decision type (such as if/else). For blocks of in-line code, the rectangles can contain function calls (as shown), the entire body of in-line source code, or remain empty.
Reviewing a Structure layout results in an understanding of not only the logic, but also of the if / for / while / switch control structure that underpins that logic.
In the Sequence layout (far right), no decisions or blocks of code are drawn in parallel. The top to bottom drawing of the flow chart mirrors the sequence of lines of code in the source file. This alternative provides a useful map for understanding where specific lines of code lie within the control logic.
The Flow Charts include a collapse action to enable this. Through the right-click menu, you can choose to collapse the internal program logic for any given decision points. All interior decisions up to the matching closing brace are hidden, and you're left with a diagram showing the control flow down to the level that you choose.
Through the Highlight menu, you can identify where specific items exist within the control flow. Typically, these items are symbols. A number of highlight alternatives exist. You can find everywhere that functions are called, variables are set, or variables are used. You can identify everywhere that specific functions and/or variables are used by selecting them in the Graph window. This diagram (right) was created by selecting the variable "ext" in the Graph window, which resulted in yellow highlighting you see.
The Flow Charts are tied particularly closely to Imagix 4D's File Editors. Highlight selections include Editor Selection and Editor Search. So for example, you can search for strings in your file editor, and see where those strings occur within the control flow of the function.
The Flow Charts and File Editors are also tied together for browsing through your code. You might display the program logic and source code side-by-side, scroll to a certain point in one, and immediately see where the corresponding point exists in the other. In this way, you can speed you understanding and review of complex functions.
Shortcut: The File Editor can be opened and scrolled to a point in the Flow Chart by double-clicking or Shift-left clicking on a point in the Flow Chart. The exception occurs when clicking on a function listed inside an in-line rectangle, in which case Imagix 4D behaves the same as anywhere else when you click on a function name / symbol.
Shortcut: The Flow Chart can be opened and scrolled to a point in the File Editor by Control-left clicking on any point inside a function definition in the File Editor.