---
title: "Decomposing a Problem into Subprograms"
description: "Splitting a task into parts small enough to write and check one at a time, then wiring the parts together into the whole program."
canonical: https://lightmysky.com/learn/computing/decomposing-a-problem-into-subprograms-mt_P293LckCnd
source: https://lightmysky.com/learn/computing/decomposing-a-problem-into-subprograms-mt_P293LckCnd.md
retrieved: 2026-09-12
---

> **Agent view.** This is the Markdown twin of the page, for tools and assistants.
> When to use this site, and the call that answers each job: https://lightmysky.com/agent-instructions.md
> API description (OpenAPI 3.1): https://lightmysky.com/openapi.json · Authentication: https://lightmysky.com/auth.md
> Pricing: https://lightmysky.com/pricing.md · Catalog: https://lightmysky.com/llms.txt · Full catalog: https://lightmysky.com/llms-full.txt
> Every machine-readable file on this domain: https://lightmysky.com/.well-known/ai-catalog.json
> Ask for Markdown with `Accept: text/markdown`, a `.md` address, or `?mode=agent`.

# Decomposing a Problem into Subprograms

Splitting a task into parts small enough to write and check one at a time, then wiring the parts together into the whole program.

Subject: Computing · Area: Programming · Ages 15 to 16
Page: https://lightmysky.com/learn/computing/decomposing-a-problem-into-subprograms-mt_P293LckCnd

## Ready when they can

- Break a described program into three or four named jobs before writing any code
- Write each part as its own function and test it on its own
- State what each part takes in and what it gives back

## Lesson: Small jobs first, big program later

Split the task into a few named jobs before you write any code. To cross a street you would check for cars, decide if it is safe, walk across, then check again. Each job is small enough to hold in your head.

**Example.** Rock, paper, scissors splits into get each choice, compare them, decide the winner, then announce it. decide_winner takes both picks in and gives the winner back. You can test it alone with made-up picks.

State what each part takes in and what it gives back. get_choice takes nothing in and gives a pick back, while announce_result takes the winner in and only prints. Clear ins and outs let the parts plug together.

**Tip.** Build and check each small piece on its own, then wire them into the whole. Small tested pieces make a program you can trust.

**Recap.** Name the small jobs, fix what each takes and gives, test each alone, then wire them together.

## Practice

8 questions on this page, each with its working shown.

## Needs first

- [Return Values and Variable Scope](https://lightmysky.com/learn/computing/return-values-and-variable-scope-mt_jivtTHpZc7)

## Opens up

- [The Project Arc: Building a Program in Stages](https://lightmysky.com/learn/computing/the-project-arc-building-a-program-in-stages-mt_hACOaB3nA_)
- [Functions at Depth: Default and Keyword Arguments](https://lightmysky.com/learn/computing/functions-at-depth-default-and-keyword-arguments-mt_SR8RhRmYhz)
