liveBook · Manning

Decomposition

As explained in Coding with AI

Problem decomposition is the division of a complex task into smaller, manageable subtasks.

Problem decomposition divides a complex task into smaller, manageable steps. It turns an unclear goal into focused questions that can be handled through one prompt or a sequence of prompts. section 9.5.1

A practical decomposition workflow:

  • Break the task into a logical sequence of subtasks. section 9.5.1
  • Design a focused prompt for each subtask, encouraging explanation and attention to best practices. section 9.5.1
  • Evaluate each response and continue narrowing the problem through follow-up questions. section 9.5.1

Decomposing an API request

For the goal of sending an HTTP GET request with Python’s requests library, separate the work into initializing the request, displaying the response body, and handling network errors or non-200 responses. Ask a focused prompt about each part, then review the results before moving on. section 9.5.1

Figure 9.6 A chain-of-thought prompt gets the model to reason out a problem like a human would. You break down the problem and experiment with answers until you get the results you desire.
A diagram of a diagram

Description automatically generated

Use the figure to visualize decomposition as an experiment: split the problem, try focused prompts, and refine the answers. section 9.5.1

How Coding with AI covers it

How deep it goes
Explains decomposition through subtasks, prompt design, and iterative evaluation, using an HTTP request as the worked scenario.
Examples
Uses container troubleshooting and a Python requests API call, including response display and network or status errors.
What you can do after
Apply it via sequential prompts to plan an HTTP GET request and guide focused follow-up questions.
How it connects
Connects problem decomposition with prompt engineering, HTTP requests, error handling, and iterative evaluation.

Also explained in

Compare how 10 books explain decomposition →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Coding with AI. The section links point to the parts of the book it draws on.