AI-assisted coding and maintenance · Module 1: AI-assisted coding and maintenance in practice
Debug with a minimal reproduction
Learning outcome: Reduce uncertainty before asking for another rewrite.
When generated code fails, capture the exact symptom, input and environment. A minimal reproduction keeps the smallest set of conditions that still produces the problem. This helps distinguish a code defect from a stale build, configuration issue or incorrect expectation.
Change one relevant factor at a time. Preserve the original failure and record what each experiment ruled out. Avoid pasting credentials or personal records into a debugging conversation. A rewritten module that happens to work once is weaker evidence than an identified cause and a targeted fix that survives the original failing case.
Worked example
A fictional export works with plain text but fails when a title contains an ampersand. The minimal example is the title “Research & review”, not the full private portfolio. Inspecting XML escaping identifies the missing transformation. Replacing the whole export library would obscure the cause and add unrelated risk.
Try it yourself
Write a bug report for the ampersand failure with expected result, actual result, minimal input and one proposed diagnostic check.
You can do this exercise on paper. If using an assistant, keep to the fictional material and an approved tool.
Compare your approach
The report should retain the exact special character and confirm whether the generated document is well-formed. Test angle brackets and quotes too if the same escaping boundary handles them. Do not claim every Word feature has been tested.
Check your understanding
What is the most useful first debugging input?
- The smallest non-sensitive example that still fails
- The entire private production dataset
- A request to rewrite every file from scratch
Show the answer and explanation
Answer: The smallest non-sensitive example that still fails. A minimal example preserves the failing condition while removing irrelevant complexity and private data. This makes the cause easier to isolate and the fix easier to verify.
Workbook
Download the course workbook to record your answer and compare it after the knowledge check.