<div class="gmail_quote">On 6 March 2011 12:38, Jonathan M Davis <span dir="ltr"><<a href="mailto:jmdavisProg@gmx.com">jmdavisProg@gmx.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On Sunday 06 March 2011 02:59:25 Jim wrote:<br>
> Okay, so there's a discussion about identifier names in the proposed<br>
> std.path replacement -- should they be abbreviated or not? Should we<br>
> perhaps seek to have a consistent naming convention for all identifier<br>
> names in Phobos?<br>
><br>
><br>
> Some of the potential benefits:<br>
><br>
>   Legibility, understandability and clarity (reduce ambiguity).<br>
>   Ease in finding a suitable function/class by name.<br>
>   Knowing if it's a cheap or costly function call.<br>
>   Aesthetics and professional appearance.<br>
><br>
><br>
> Some properties that I can think of for discussion:<br>
><br>
>   Abbreviation (and if so, what to abbreviate and how much)?<br>
>   Preference of commonly used terms in other languages, contexts?<br>
>   Use of get and set prefixes or not (getName() or simply name())?<br>
>   Explicit use of a prefix (example: calc or calculate) for costly<br>
> operations?   Naming of function and template arguments?<br>
>   Uppercase, lowercase, camelcase, underscore in multi-word names? All caps<br>
> for constants, or different appearance for different types (types,<br>
> functions, arguments, constants...). What about acronyms: TCP, Tcp?<br>
><br>
> Are there other concerns?<br>
<br>
</div></div>The general naming convention as far as variable names go is camelcased with the<br>
name starting with a lower case letter - this includes constants. Most of Phobos<br>
follows this, and the parts that haven't been have been moving towards it. There<br>
are likely to be a few exceptions, but on the whole, that's how it's supposed to<br>
be. Type names are the same, except they start with an upper case letter (this<br>
includes enum names - the enum values are capitalized the same as any other<br>
variables however). That's the way it has been, and that's the way that it's<br>
pretty much guaranteed to stay.<br>
<br>
Generally speaking, we want descriptive names, and I think that it's safe to say<br>
that we don't want overly long names, so if we can have descriptive but short<br>
names, that's generally best. get and set prefixes are likely to be rare, because<br>
most of such functions will be properties, and properties will normally have<br>
nouns for names and won't use get or set, but I don't think that we want to say<br>
that we'll _never_ have function names prefixed with get or set. Normally, we<br>
won't, but it's going to be very situation-dependent.<br>
<br>
Now, as for the rest of it, I don't really want to get into a big discussion of<br>
the best way to name everything. It's far too context-dependent and very quickly<br>
turns towards bike shedding. I think that it's appropriate for anyone who's<br>
developing a module for Phobos to come up with names that they think are<br>
reasonable and which follow the very basic naming conventions that we follow,<br>
and then have names adjusted as needed during the review process. I really don't<br>
think that we're going to get much of value by having a big discussion over<br>
general naming conventions. It seems to me like it's just going to be a classic<br>
situation for bike shedding and generally useless discussion. What we've been<br>
doing generally works just fine.<br>
<font color="#888888"><br>
- Jonathan M Davis<br>
</font></blockquote></div><br>Just a thought, is there some sort of tool whats able to check if a code follow these standards?<div>And if its the case, why isn't it used? - so people are forced to conform to the coding standard before being able to commit anything.<br clear="all">
<br>-- <br>// Yours sincerely<br>// Emil 'Skeen' Madsen<br>
</div>