Names consistency


Link to this posting

Postby Ursego » 21 Feb 2013, 10:24

Don't produce different versions of a name for a same entity.

When you use values, retrieved from database tables, name the corresponding variables exactly as the DB fields (adding naming convention prefixes where needed, of course). For example, if the DB field is empId, then your variable should be empId too - not empNo, empNum, employeeNo, employeeNum or employeeId.

But if DB fields names are not informative enough, then you can feel more freely, especially when you are coding financial calculations. For example, if the DB field totalHours contains the number of hours the employee has worked in a particular day, it's better to accommodate the retrieved value in a variable named hoursPerDay. Understandability is more important, than consistency.
User avatar
Ursego
Site Admin
 
Posts: 131
Joined: 19 Feb 2013, 20:33



IF you want to ((lose weight) OR (have unbelievable (brain function AND mental clarity))) THEN click:




cron
free counters

eXTReMe Tracker