To create a structure diagram, start by identifying the Main Task and placing it at the top of the page. This should be a broad description of what the software or algorithm is intended to achieve.
Identify the major functional areas required to complete the main task. These become the second level of the diagram, typically arranged horizontally from left to right in the order they might logically occur.
Continue the process for each sub-task until you reach a level of atomic tasks. An atomic task is one that is simple enough to be written as a short block of code without needing further decomposition.
It is essential to distinguish structure diagrams from other algorithmic tools to ensure they are used correctly during the design phase.
| Feature | Structure Diagram | Flowchart | Pseudocode |
|---|---|---|---|
| Purpose | Shows problem decomposition | Shows logical flow/sequence | Shows detailed logic in text |
| Focus | 'What' needs to be done | 'How' the data moves | 'How' the code is written |
| Structure | Hierarchical (Tree) | Sequential/Branching | Linear text |
| Timing | High-level planning | Detailed logic design | Implementation prep |
Unlike flowcharts, structure diagrams do not typically show loops or decisions explicitly. Instead, they show the static relationship between the parts of the problem.
Identify the Root: Always look for the single box at the very top; this is the primary goal. If an exam asks you to complete a diagram, ensure the new boxes logically contribute to the parent box above them.
Check for Completeness: Ensure that every sub-task required by the parent is present. If a system requires 'Login', 'Process', and 'Logout', all three must be represented as children of the main system.
Logical Order: While structure diagrams are hierarchical, sub-tasks are often placed from left to right in the order they are expected to execute. Use this convention to help place missing components correctly.
Avoid Logic Overload: Do not try to include 'IF' statements or 'WHILE' loops inside the boxes. The boxes should contain short, descriptive noun-verb phrases like 'Calculate Total' or 'Print Receipt'.
Confusing Decomposition with Flow: A common mistake is treating a structure diagram like a flowchart. Remember that a structure diagram shows the parts of a problem, not necessarily the order of every single step.
Inconsistent Granularity: Ensure that boxes on the same level represent a similar scale of task. Mixing a tiny detail (like 'Add 1 to counter') with a massive sub-system (like 'Database Management') on the same level makes the diagram difficult to read.
Dangling Nodes: Every box (except the top one) must be connected to exactly one parent. A box without a parent is logically disconnected from the problem you are trying to solve.