Exceptional coding style

Ali Çehreli acehreli at yahoo.com
Mon Jan 14 11:52:43 PST 2013


On 01/14/2013 11:24 AM, Walter Bright wrote:
> Quite a nice read on the coding style used in Doom.
>
> http://kotaku.com/5975610/the-exceptional-beauty-of-doom-3s-source-code?post=56177550
>

Here begins another epic thread. :)

I haven't read the article but came across this: "I personally enforce 
the rule that all method names should begin with a verb unless they 
can't." The author adds that he prefers getLength() to length().

That rule is misguided because not every member function represents an 
action; there are also attributes. Attribute methods should be nouns, in 
D or in C++. In our C++ code we simply say length() (and setLength() if 
needed).

Ali


More information about the Digitalmars-d mailing list