Skip to main content

Sign in to CleanKata

Track your progress, earn XP, and unlock every lesson.

By signing in you agree to our Terms of Use and Privacy Policy.

Clean Code60 XP6 min

Environment & Truth

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

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.

🔧 Some exercises may still have errors. If something seems wrong, use the Feedback button (bottom-right of the page) to report it — it helps us fix it fast.

Hint: G3: Don't trust intuition — enumerate every boundary. G8: Suppressed warnings are hidden bugs.

✗ Your version

Environment & Truth — CleanKata — CleanKata