Naming consistency
I recently had to interface to some code written by another project. My attention was drawn to some data transfer objects (DTOs) and the lack of consistency in naming attributes. A common feature of these DTOs were an object ID and a display text. The object IDs were variously named as
That the attribute "value" might be the Object ID in one class but the display text in another was disturbing. I am unable to guess how many bugs – past, present and future – such naming is responsible for, but I am sure it is many, many. This is the sort of thing that code reviews can pick up; it will come as no surprise to learn that the project in question "did not have time to do code reviews"
Category: Programming,Software
id
, value
, typeCode
; often in combination with the class name. The display text were correspondingly named value
, name
, valueText
and the like. That the attribute "value" might be the Object ID in one class but the display text in another was disturbing. I am unable to guess how many bugs – past, present and future – such naming is responsible for, but I am sure it is many, many. This is the sort of thing that code reviews can pick up; it will come as no surprise to learn that the project in question "did not have time to do code reviews"
Category: Programming,Software
0 Comments:
Post a Comment
<< Home