Exact action timing

Share this topic:



Link to this posting

Postby Ursego » 21 Feb 2013, 10:37

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.
User avatar
Ursego
Site Admin
 
Posts: 112
Joined: 19 Feb 2013, 20:33

Return to Art of Naming

Who is online

Users browsing this forum: No registered users and 1 guest


Exact action timing

Share this topic:


If you think that this site is not too bad, please LIKE it in Facebook. Thanks!





free counters

eXTReMe Tracker