Writing Effective Praise
Introduction
Welcome back to Comments That Get Merged. We’re at lesson 3, where we’ll add a useful skill to the review habits from earlier lessons: writing praise that helps an author understand which decisions are worth repeating. We’ve already practiced identifying blocking issues and optional nits, labeling them clearly, and grounding feedback in evidence. Now we’ll use a completed ticket example to praise both a simple design choice and a test that documents important behavior.
Tracing the Latest-Note Workflow in main.py and latest_note()
Let’s follow what happens when the example runs. In main.py, create_ticket() creates a ticket, add_note() attaches a note, and latest_note() supplies the value that is printed. In app/tickets.py, latest_note() first checks whether there are notes. It returns None when the list is empty; otherwise, it returns the last item, which is the newest note.
The first snippet shows the example’s use of the ticket. The second shows how the method handles both an empty list and a list with notes.
This output confirms that the newest note is returned after it is added. The empty case is not shown in this run, so we’ll use a test to examine that contract.
Why the Design Deserves Praise: Behavior Beside Its Data
The method belongs to Ticket, the same object that owns the ordered notes list. A future contributor looking for note behavior can find it beside the data it reads. This is useful praise because it names a choice and explains its value rather than simply approving the code.
The implementation also uses self.notes[-1] directly. As you may recall from earlier units, YAGNI asks us not to add complexity for needs we do not have. For this small requirement, a helper or extra abstraction would add another place to look without improving the behavior.
Looking back at the method shown above, it uses the ticket’s own state, checks the boundary, and reads the newest item directly. That is enough to meet the requirement. Praise can point out both the helpful placement and the restraint while staying specific to what the code actually does.
