Wednesday, February 27, 2008
posted by Simon at 9:35 AM. Permalink
There is no correct answer as to how to name unit variables. If you use the name height, then confusion over units can indeed occur. If however you use heightInInches, then maintenance becomes tough if future requirements mean switching to cm or furlongs, as the name must be changed, or conversion routines must be wrapped around all reads and writes to the value.
True, although these concerns would still occur if the column was named "height". This way, at least the maintenance coder knows what their dealing with.I don't think conversion is a big deal though. I'm sure we all do it regularly with storing and retrieving dates and times. I can't think of a better way of doing it than putting the unit in the name.
Post a Comment
Create a Link
<< Home