Programming foundations

Stage 5 · Lesson 4 of 10

Separation of concerns

Object-oriented design and clean code

means each part of a program handles one kind of job. The most useful split for your projects has three parts. Input and output covers reading files, asking the user and printing.

Core logic covers calculations and rules. Data covers the structures that hold your records. When the logic never prints or reads input itself, you can test it with plain values.

You can also reuse it from a web page later, and change the output format without touching the rules. The milestone asks for exactly this split. The warning sign is a that asks for input, does the maths and prints the answer all at once. The only way to test it is to type into it.

A question to check yourself, an AI practice session and 1 cheat sheet entry come when you add the roadmap to your account. Add it

Resources for this stage

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

Mark this stage as not done?