Overview

1 The path to well-designed software

This opening chapter sets the stage for building sustainable, well‑designed Python applications. It explains that thoughtful design yields reliability, flexibility, maintainability, easier testing, and often faster delivery. The book’s approach is to teach object‑oriented design principles and industry‑proven design patterns through simple, focused Python examples—showing before/after improvements—so readers from beginner to intermediate (and those seeking a refresher) can develop code that endures evolving requirements and is transferable to other OO languages.

Design is framed as a disciplined journey from requirements to implementation: first ensure you will build the right application by gathering, validating, and analyzing what users need; then build it right via iterative design–code–test cycles, making tradeoffs and backtracking when necessary rather than relying on a “Big Bang.” The chapter previews how principles sharpen local code (clarity, performance, fewer surprises) and how patterns supply architectural guidance, and it samples common pitfalls to avoid: change leaking through tight coupling, classes burdened with too many responsibilities or sprawling hierarchies, hardcoded choices that hinder extensibility, and APIs that behave unexpectedly. It also touches on recurring architectures such as publisher–subscriber and points to the Observer pattern as a model solution.

Two themes dominate: change and complexity are the chief enemies of good design. The remedy is to plan for change—without letting abstractions grow unwieldy—by using core OO concepts as a foundation: encapsulation (including the practice to encapsulate what varies), abstraction to reduce detail, inheritance to share behavior responsibly, and polymorphism to keep code flexible. The chapter closes by emphasizing MVP‑first progress, collaboration and maintainability, and the importance of being able to assess or guide AI‑generated code so it aligns with solid principles and appropriate patterns.

A hierarchy of classes and subclasses. Does it have to be so complex? Good design techniques can simplify this data.
Publisher–subscriber is a common software architecture situation. One application component produces data that other application components consume. The Observer Design Pattern provides a model to solve this problem.
The Big Bang theory of application development. If we write lots of code in a prolonged marathon instead of developing the software iteratively, we can only hope that the Big Bang at the end will magically produce a working application. Unfortunately, that magic rarely happens.

Summary

  • Design is a disciplined engineering approach to creating a solution to a problem. In software engineering, the problem is to create working software, and the solution is a well-designed, sustainable application.
  • Well-designed software is better in many ways, such as being more reliable, flexible, and maintainable. Good design helps ensure that applications are completed on time and do what their clients expect.
  • It is possible to become a better programmer by using good software design techniques that include good design principles and design patterns.
  • Good design principles help make our code more flexible and able to handle changes such as new requirements. Design patterns are industry-proven models for creating solutions to common software architecture problems.
  • Software design starts by acquiring and analyzing an application’s requirements to ensure that we’re developing the right application. The application must do what it’s supposed to do.
  • Developing a well-designed sustainable application nearly always requires multiple iterations with backtracking over bad design decisions. It’s hard work. Don’t rely on a magical Big Bang at the end of a marathon coding session.
  • Good software design must deal with the major challenges of change and complexity.
  • The design principles and design patterns in this book are based on the object-oriented programming concepts of abstraction, encapsulation, inheritance, and polymorphism.
  • Encapsulation also means isolating the parts of a program that can change. Then, when changes do occur, they won’t leak out and cause changes to other parts of the program.

FAQ

What is software design?It is a disciplined engineering approach to creating an application that meets its requirements. In practice, it means applying design principles to improve code and using design patterns as proven models to solve common architecture problems on the path from requirements to a sustainable, well-designed application.
How do design principles differ from design patterns?Design principles are guidelines that improve code at many levels (from a few lines to cooperating classes), helping reduce surprises, improve flexibility, and simplify maintenance. Design patterns operate at a higher architectural level; they are industry-proven models (built on principles) for recurring problems, such as publisher–subscriber communication modeled by the Observer pattern.
Who is this book for, and what are the prerequisites?It targets beginning to intermediate Python developers (and serves as a refresher for experienced ones). You should know Python basics, core data structures and algorithms, and object-oriented programming, and be comfortable writing, editing, debugging, and running small applications.
What will I learn from this book?You’ll learn to: - Apply design principles to improve code quality - Use industry-proven design patterns to solve common architecture problems - Gather, validate, and analyze requirements to build the right application - Develop iteratively and recover from poor design decisions
What are the main benefits of good software design?Well-designed software typically: - Meets requirements and behaves as expected - Is reliable, testable, and efficient - Remains flexible and scalable as requirements change - Is easier to maintain and collaborate on - Uses appropriate principles and patterns to reduce duplication and complexity - Saves time and cost over the application’s lifespan
Why is iterative development emphasized over a “Big Bang” approach?Good design rarely emerges in one shot. Iterative design–code–test cycles help you make tradeoffs, correct wrong turns, and reach a minimum viable product faster. The “Big Bang” marathon usually leads to disappointing results because issues aren’t discovered and addressed early.
What common design problems does this chapter highlight?Examples include: - Leaking changes: tight coupling forces edits across classes when one changes - Overly complex classes: types that try to do too much become hard to test and debug - Class proliferation: deep hierarchies that add complexity and dependencies - Inflexibility: hardcoded decisions (like fixed types) that resist change - Surprises: code that yields unexpected or incorrect results due to poor design
What does “Build the right application; then build it right” mean?First, acquire and analyze requirements to ensure the application solves the intended problem. From those, identify an initial set of classes. Then apply good design techniques and patterns to implement the application correctly and sustainably.
Which OOP concepts underpin the design techniques in this book?Four core concepts: - Encapsulation: bundling state and behavior; also used to contain change (“Encapsulate What Varies”) - Abstraction: focusing on what matters to reduce complexity - Inheritance: reusing and specializing behavior via parent/child classes - Polymorphism: runtime behavior determined by an object’s concrete subtype
How should I treat AI-generated code with respect to design?Verify correctness first, then assess design quality: check for sound principles, appropriate patterns, and a coherent architecture. As you learn principles and patterns, you’ll be able to prompt AI tools more effectively to generate well-structured, sustainable code.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Software Design for Python Programmers ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Software Design for Python Programmers ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Software Design for Python Programmers ebook for free