Chapter 1

Decomposition and Pattern Recognition

Break big problems into small parts (decomposition) and spot similarities (pattern recognition) to solve them faster.

What is decomposition?

Decomposition means breaking a large, complex problem into smaller parts that are easier to understand and solve. Instead of facing one big task, you deal with several small tasks one at a time. When each small part is solved, the whole problem is solved.

For example, building a simple game can be broken into smaller jobs: draw the player, move the player, keep the score and show a "game over" message. Each job is small enough to handle on its own.

Example

To plan a class party, decompose it into food, drinks, music, decoration and the guest list. Each person can then work on one small part.

What is pattern recognition?

Pattern recognition means looking for similarities or common features, either between different problems or within one problem. When you notice that parts are alike, you can reuse the same idea instead of starting again each time.

In the game above, "move the player" and "move the enemy" follow a very similar pattern: change a position, then redraw. Spotting this lets you write one method and use it for both.

Key idea

Decomposition asks "What smaller parts is this made of?" Pattern recognition asks "What is similar or repeated?" Together they make a hard problem much easier.

Why they matter

Both are part of computational thinking. Decomposition keeps each part small, and pattern recognition saves time by reusing solutions. Used together, they turn a confusing problem into a clear plan.

Remember

  • Decomposition = break a big problem into smaller parts.
  • Pattern recognition = find similarities that can be reused.
  • Both belong to computational thinking, not to hardware.

Stuck on this topic? A verified JomKelas tutor can walk you through it.

Find a verified tutor