Page 1 of 1

Exact action timing

PostPosted: 21 Feb 2013, 10:37
by Ursego
Names, describing actions, must express if the action should be done in the future or has been already done in the past.

Giving names to variables and tables' fields, don't force readers to guess an action timing. For example, in one of my project two different tables had fields named calc_method, but one of them stored the method to be used in the next calculation, while the second one contained the method already used in the last calculation. Why not to call the columns calc_method_to_use and calc_method_used accordingly if that can improve understanding of the business and SQLs?

Boolean names consisting of a noun only (without a verb) is another sad story. What do you think about a Boolean variable named isCalculation? Calculation - what??? How must the condition if (isCalculation) be understood? As you see, no understanding problem exists if the variable is named isCalculationDone (isCalculated) or in the imperative form - doCalculation (or simply calculate).

So, the common advice is to use words do..., ...ToDo, perform..., execute..., ...ToApply etc. for stuff which should take place in the future, and ...Done, ...Performed, ...Executed, ...Occurred, ...Passed, ...Applied etc. for things which have taken place in the past.