Functions & Decomposition
📋 What it is
A function is a named, reusable block of code that does one job; decomposition breaks a big problem into such pieces.
🗣️ Coach says
A FUNCTION is a mini-program with a name that does one job — call it whenever you need that job done, instead of rewriting it. DECOMPOSITION is breaking a big problem into small function-sized pieces. Together they turn a scary big task into a set of small, solvable ones.
🧠 Memory hook
A function = a named reusable job. Decompose big problems into small function-sized pieces.
😂 Giggle
Why do programmers prefer dark mode?
Because light attracts bugs!
😲 Whoa!
Every huge program — even the one running a spacecraft — is built from thousands of small functions, each doing one tiny, testable job.
✅ Quick check: What is "decomposition" in programming?
Say your answer out loud first — then reveal.
Breaking a big problem into smaller pieces (often functions), each doing one job — making a hard task manageable.
Decomposition splits complexity into small solvable parts.
🧪 Try it! (2 minutes)
Take a big task (make breakfast) and break it into named "functions": makeToast(), pourJuice(), etc.