I'll Be Backend
Principles

Pure Functions: Push I/O to the Edges

A pure function gives the same answer for the same inputs and changes nothing outside itself. These lessons take a late fee job that reads the clock, reads the database, writes fees and sends mail in one loop, pull the fee rule out into pure functions, and leave the input and output in a short shell at the edge, so Finance's fee cap and its test touch only the rule.

Pick your language

When to use it

Use it when

A business rule sits inside code that talks to a database, the clock, files or the network, and you want to test the rule alone.

Skip it when

The code is only glue with no decision in it, like copying a file and logging that it was copied. There's no rule to pull out.

Spot it by

A now() or a database call in the middle of a calculation, or a test that needs a fake for every collaborator to check one number.