Readability and naming.
Sean Kelly
sean at f4.ca
Wed Jan 10 14:34:59 PST 2007
Mike Gerfin wrote:
> I came to this site following the link from Dr. Dobb's and love
> what I see. I can't wait to start implementing my next project
> in D! However, on the subject of readability and D's promise
> (or goal) to make things easier for other programmers, I wish
> that C/C++ programmers would eliminate their attachment with
> needlessly terse variable and function names. Granted, I've
> only been going through the site a few hours, but in many examples
> I see things like:
>
> int w_count, l_count; // etc.
>
> Why can't we use:
>
> int wordCount, lineCount;
>
> I realize these are just examples, but if people get used to
> seeing descriptive naming used it will hopefully become the norm.
> Let's not persist with habits born from the days of FORTRAN.
Personally, I think variable names should be clearly understandable to a
code reviewer, but this doesn't always equate to long names. I feel
that scope, for example, plays a large part in what represents a
meaningful name. Local variables inside a small function are just fine
at one or a few letters, and this may actually improve code readability
by keeping algorithms compact. However, the broader the scope is, the
longer the names tend to become, in an attempt to provide contextual
information.
Sean
More information about the Digitalmars-d
mailing list