Briefle words · Code & architecture
Intention-revealing name
A name that says what a value means or what a function is for, not how it is stored or built.
Say it to an AI
TypeScript function calculateOrderTotal(cart: Cart) that sums line items, applies the coupon's percentOff and adds shipping unless the free-shipping minimum is met. Use intention-revealing names for every identifier (subtotal, discount, shippingFee, no single letters or tmp) so the code is self-documenting.
How an expert would brief the stronger version of “Order total”.
See it
Try it as a puzzle →The function that adds up a shopping cart at checkout in an online store.
Why: 'd' and 's' could stand for anything (is 's' shipping, subtotal or savings?); 'discount' and 'shippingFee' say what the number is. Even the callback changes: '(sum, item)' versus '(acc, i)'.
More ways experts use it
JavaScript calculateOrderTotal(order, taxRate) for checkout: subtotal from lineItems, minus coupon.amountOff, plus tax on the discounted amount, plus shipping unless it clears the free-shipping minimum. Full-word, intention-revealing names everywhere, no abbreviations like amt or txbl, and named constants for the shipping rules.
Order total · Code & architecture
Related words
Room 1 · Essentials
Learn “Intention-revealing name” in a five-minute lesson