Step 1: Component Identification: Use abstraction to remove irrelevant details and focus on the core data (inputs, outputs, and transformations) required for the solution.
Step 2: Decomposition: Break the identified components into major tasks. For example, in a data processing system, tasks might include data entry, calculation, and reporting.
Step 3: Sequencing: Determine the chronological or logical order. This involves asking: 'Which task must finish before the next can begin?' and 'Are there tasks that can run in parallel?'
Step 4: Refinement: Continue breaking down tasks into sub-tasks until each can be implemented as a single, discrete subroutine or function.
| Feature | Decomposition | Abstraction |
|---|---|---|
| Purpose | Breaking a problem into smaller parts | Removing unnecessary detail to focus on core components |
| Outcome | A set of sub-tasks or sub-problems | A simplified model of the problem |
| Focus | Structure and manageability | Clarity and essential data |
Procedure vs. Function: While both are units of computation, a function specifically returns a value to the calling routine, whereas a procedure (in a general sense) executes a sequence of instructions to perform a task without necessarily returning a result.
Top-Down vs. Bottom-Up: Top-down starts with the 'big picture' and drills down into details, whereas bottom-up starts with existing low-level components and builds them into a larger system.
Identify Dependencies: When asked to order steps, always look for the 'output' of one step that is needed as the 'input' for another. You cannot calculate an average before you have the sum and the count.
Use Hierarchy Charts: In exams, if a problem is complex, sketch a quick hierarchy chart to visualize the decomposition. This helps in identifying missing steps or logical errors in the sequence.
Check for Atomicity: Ensure that each step in your proposed order is 'atomic'—meaning it performs one specific task. If a step feels too broad, it likely needs further decomposition.
Verify the Goal: Always cross-reference your final step with the original problem requirements to ensure the sequence actually leads to the desired output.
Skipping Decomposition: Attempting to solve a large problem in one go often leads to complex, unmaintainable code and logic errors that are difficult to debug.
Incorrect Sequencing: Placing a step that requires specific data before the step that generates that data is a common logical error (e.g., trying to sort a list before it has been populated).
Over-Decomposition: Breaking tasks down into steps that are too small can lead to an excessive number of subroutines, making the program structure unnecessarily complex and harder to follow.