Expressiveness & Algorithms
Use explanatory variables, precise names, and a deep understanding of the algorithm to make code speak for itself.
Explanatory Variables
G19: When a complex expression fills a line, the reader must mentally evaluate it to understand its meaning. Break it into named steps. Each intermediate variable becomes a comment that can't go stale — it is the computation, named. This is especially important for mathematical formulas, regular expressions, and multi-part boolean conditions.
Precise Names & Algorithm Understanding
G20: A function's name is a contract. getUser promises a read with no side effects. If it also logs, caches, and audits, the name is a lie. Use a name that is the complete truth — even if it's longer. G21: Don't stop working on an algorithm when the tests pass. Understand it. Refactor it until you can explain every line. Code you don't fully understand is code you can't safely change.
Code Challenge
Break the dense formula into explanatory named variables.
💡Key takeaway
Expressive code is not about being clever — it's about being clear. Name every important intermediate result.
🔧 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: G19: Break dense formulas into named variables. G20: The function name must be the complete truth about what it does.
✗ Your version