Shipping Reviewable Changes
Introduction
Welcome to Ship a Reviewable Change. We are beginning the first unit and the first lesson of this course, so this is our starting point for building a reliable review habit. Our running example is a small support ticket change. A healthy change should do more than avoid bugs: it should be understandable to a new contributor, maintainable as the project grows, easy to verify, and limited to its intended behavior. Together, we will trace the ticket lifecycle, inspect names and documentation, read tests as evidence, compare the runnable example with contributor guidance, and keep review feedback focused.
Begin with the Intended Behavior and Scope
Before reading individual statements, we define the change’s contract. This keeps a review from becoming a list of every improvement we can imagine. The required behavior is narrow: Ticket stores an identifier, title, notes, and status; a new ticket starts as "open"; create_ticket() stores the object under its identifier and returns that same object; add_note() keeps notes attached; and close() changes the status to "closed".
The following sketch captures the behavior we need to protect:
This code establishes the smallest useful change: create, store, and close a ticket. A request for reopening, extra statuses, database persistence, or broad refactoring would expand the contract. We can record such ideas for later, but they should not distract us from checking whether the current behavior is clear, correct, and easy to maintain.
Trace Responsibilities Through the Ticket Lifecycle
With the contract in hand, we can follow one ticket in execution order. Start with create_ticket(), then inspect how the Ticket object is initialized. The factory creates and stores the object, while the model owns its fields and status. This separation gives each responsibility a clear home.
The lifecycle diagram shows where creation, storage, and the explicit status transition occur:
Ticket.__init__() creates a complete initial state. create_ticket() stores the same instance that it returns, so callers and the dictionary refer to one ticket. The factory does not manage later status changes.
The executable example then coordinates the lifecycle:
Here, main() supplies the storage dictionary, creates a ticket, and calls the clearly named lifecycle operation. The status transition stays inside Ticket.close(), which makes the behavior easy to locate and review.
