Skip to main content
Clean Code 60 XP · 6 min

Environment & Truth

Build systems that compile in one step, run all tests in one step, and never lie through suppressed warnings.

Showing
Ad (728×90)

Multiple Languages in One File

Build systems should compile and run with a single command. When a single source file mixes HTML, CSS, JavaScript, and SQL it signals a design failure — each language belongs in its own module. G1: Follow the Principle of Least Surprise — if a function is named getTodaysDate(), it must return today's date, nothing else.

Boundary Conditions & Suppressed Warnings

G3: Boundary conditions are where most bugs live. Don't trust your intuition — write down every edge case and test it explicitly. The off-by-one error, the empty collection, start equals end — these are the corners that bite. G8: Suppressing a compiler or linter warning is the same as lying. Fix the root cause instead.

Code Challenge

Fix the range-check function to handle all boundary conditions.

Key takeaway

A system that compiles cleanly, tests completely, and never suppresses warnings is a system you can trust.

Done with this lesson?

Mark it complete to earn XP and track your progress.