musou wrote
this is a good tip, one codebase i worked on actually had a whole module just dedicated to constants with beautiful names such as @largest_integer_that_can_be_represented_in_ten_digits_of_base36
twovests OP wrote
oh, i was actually complaining haha. i find it difficult to understand examples when they use a lot of good practices, like 1. many constant names. 2. referring to code examples in another file, commit, or branch (vs commenting out alternatives), 3. bogging down code with catching errors, etc.
but that constant you provided makes sense, i wouldn't recognize that number.
musou wrote
oh it's definitely possible to overconstantize too... things like @cents_in_a_dollar
constants pop up sometimes when converting a price from integer cents to a display form with 2 decimal places, which i think is a value that is safe to assume most people know
Viewing a single comment thread. View all comments