Level 2: Clean Code & Professional Engineering
Write code others can safely change, and behave like a professional under pressure. Level 2 of 11: 7 lessons on clean code & professional engineering.
Outcome: Write code others can safely change, and behave like a professional under pressure.
ShopFlow’s first codebase has a 2,000-line OrderService and no tests. We clean it up with naming, separation of concerns, tests, TDD and refactoring — and learn the professional habits that keep it clean when deadlines hit.
The pressure on ShopFlow: A second developer joins and cannot understand the code without asking.
Lessons in level 2
- Names and Functions That Explain Themselves — Good names and small functions turn code into documentation that cannot go stale.
- Separation of Concerns: Untangling the God Service — Split the 2,000-line OrderService by responsibility, one safe step at a time.
- Tests That Let You Change Code Without Fear — Unit, integration and end-to-end tests — what each buys you and what each costs.
- Test-Driven Development in Practice — Red, green, refactor on a real ShopFlow discount rule.
- Refactoring in Small, Safe Steps — Change structure without changing behaviour, protected by tests.
- Technical Debt: The Loan You Didn’t Know You Took — Deliberate vs accidental debt, interest payments, and how to pay it down.
- The Professional Engineer: Estimates, Deadlines & Saying No — Honest estimates, clear commitments and staying clean under pressure.
Source books
- Clean Coder — Robert C. Martin
- Pragmatic Programmer — David Thomas, Andrew Hunt