Naming things in Phobos - std.algorithm and writefln
Michel Fortin
michel.fortin at michelf.com
Wed Aug 5 04:58:20 PDT 2009
On 2009-08-05 03:49:34 -0400, Robert Fraser <fraserofthenight at gmail.com> said:
> Michel Fortin wrote:
>> As you know, I tried to write some guidelines[1] for naming things in
>> D. Those guidelines looks well at first glance, but then you look at
>> Phobos and you see that half of it use some arbitrary naming rules.
>> Take "writefln" for instance: following my guidelines (as they are
>> currently written) it should be renamed to something like
>> "writeFormattedLine".
>>
>> [1]: http://prowiki.org/wiki4d/wiki.cgi?DProgrammingGuidelines>
>
> I think naming guidelines aren't a bad thing, but they can be taken too
> far. We use an automated tool at work to check code and today I was
> forced to change the name of some classes because they ended in "Queue"
> or "Dictionary" and "fix the spelling" of "Http" because it thought it
> was Hungarian notation.
That's indeed ridiculous. But that's not an example of guidelines gone
too far, that's an example of a silly tool that's not even able to
apply guidelines correctly.
The guidelines I wrote are human-verifiable, not machine verifiable,
and sometime require judgement. Exceptions to the guidelines are fine,
as long as they have a good rationale supporting them.
Even better than making exceptions to the guidelines is creating
standardized patterns and adding it to the guideline. as I did with
"to" functions (they don't start with a verb like the guideline says,
but they are used as a convention for convertion functions).
--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/
More information about the Digitalmars-d
mailing list