Software Engineering Architecture Lab

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

  1. Names and Functions That Explain Themselves — Good names and small functions turn code into documentation that cannot go stale.
  2. Separation of Concerns: Untangling the God Service — Split the 2,000-line OrderService by responsibility, one safe step at a time.
  3. Tests That Let You Change Code Without Fear — Unit, integration and end-to-end tests — what each buys you and what each costs.
  4. Test-Driven Development in Practice — Red, green, refactor on a real ShopFlow discount rule.
  5. Refactoring in Small, Safe Steps — Change structure without changing behaviour, protected by tests.
  6. Technical Debt: The Loan You Didn’t Know You Took — Deliberate vs accidental debt, interest payments, and how to pay it down.
  7. The Professional Engineer: Estimates, Deadlines & Saying No — Honest estimates, clear commitments and staying clean under pressure.

Source books

Other levels