[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Pulp-list] Agent: Package.install() API



On 11/11/2011 12:03 AM, Jeff Ortel wrote:
> On 11/09/2011 02:54 PM, Jay Dobies wrote:
Can you change the delay key to be something like "delay_in_min"? I'm
a big fan of keys
having their units built right into the name; makes it easier on the
user in case we
forget .conf file comments and easier on the developer so they know
what it is they are
pulling in when they retrieve that value.

I kind of lean toward putting the units in the comments along with all
the other information about the property (I know, big surprise). But,
since you took the time to review this and comment ... how about I make it:

delay_minutes

One point regarding having units in variable names: when the units are only in comments or documentation, it is easy for them to get divorced from the values. I ran into this recently having to figure out what size and time duration units were being used in a database dump - I had to go back to the source code of the app that generated the data to figure it out. If the columns has just been given names ending in "_bytes" and "_seconds" there wouldn't have been any question.

A second point is that if you ever decide to change the units, you're forced to change the variable names - that means any old code that still assumes the old units are in effect is more likely to break noisily rather than silently producing incorrect answers (or, in the case of instance attributes in a language like Python, you could provide a property that automatically does the conversions to and from the old units in order to preserve backwards compatibility).

Cheers,
Nick.

--
Nick Coghlan
Red Hat Engineering Operations, Brisbane


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]