7 Problem decomposition

This chapter covers

  • Understanding problem decomposition and why we need to do it
  • Using top-down design to carry out problem decomposition and write programs
  • Writing a spelling suggestions program using top-down design

In chapter 3, we talked about why we shouldn’t ask Copilot to solve big problems. Imagine what could happen if we asked Copilot to “Design a two-player strategy game.”

In the worst case, Copilot wouldn’t do anything useful. We observe this sometimes when Copilot gives us comments again and again but never provides us with real code.

In the best case, we’d get a canned program with all the decisions made for us. That program may not match what we wanted. Part of the power of being a programmer ...

Get Learn AI-Assisted Python Programming, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.