Programming foundations

Stage 5 of 6 · 10 lessons · ~2 months

Object-oriented design and clean code

Organise programs so they stay readable as they grow: classes where they help, separation of concerns, small functions, tests first on the logic that matters, and documentation someone else can follow.

Start: Classes, objects and encapsulation

Lessons· one lesson for each topic, in this order

  1. 1Classes, objects and encapsulation
  2. 2Composition, inheritance and interfaces
  3. 3Naming and small functions
  4. 4Separation of concerns
  5. 5DRY, KISS and YAGNI
  6. 6Unit tests and edge cases
  7. 7Test-driven development
  8. 8Code smells and refactoring
  9. 9Comments, docstrings and READMEs
  10. 10SOLID as review questionsOptional

Start with· follow one of these

Practise

  • Request mentoring on a solved exercise and ask specifically about naming and structure

Keep handy

  • Get started in 20 minutes: plain assert, fixtures and running tests from the terminal

Also worth your time

Before moving on: Refactor one of your earlier programs: split input, logic and output into separate modules, remove the duplication, write unit tests for the core logic first, and add a README that explains how to run it.

Tauseef's advice
Use a class when it groups data with the behaviour that changes it, not because a tutorial made everything a class. Treat DRY, KISS, YAGNI and SOLID as questions to ask while refactoring, not rules for a first draft, and write the test before you fix any bug.

Mark this stage as not done?