Naming things: Phobos Programming Guidelines Propsal

Chad J chadjoan at __spam.is.bad__gmail.com
Wed Jul 29 14:15:35 PDT 2009


Ary Borenszweig wrote:
> Michel Fortin wrote:
>> It's interesting how the property debate is moving towards expressing
>> semantics and how sometime the English language doesn't express things
>> clearly -- empty (state) vs. empty (action) comes to mind.
>>
>> Now that the debate is moving towards how to name things, perhaps it
>> is time we establish a clear set of guidelines. Here's my attempt at it:
>> <http://prowiki.org/wiki4d/wiki.cgi?DProgrammingGuidelines>
>>
>> It obviously lacks a few things, and doesn't fit half of today's
>> Phobos very well. But I hope this document can bring some consistency
>> to Phobos and other D projects. Feel free to discuss and improve the
>> document as you see fit.
> 
> There's a paradox. :-P
> 
> You say a class' name should be a noun. And you say a class' name
> shouldn't repeat it's base class name.
> 
> Say you have an Action class, very common in UI toolkits and things like
> that. Now you have an action to connect two things. Two alternatives:
> 
> 1. class Connect : Action {} // wrong, Connect not a noun
> 2. class ConnectAction : Action {} // wrong, repeats Action
> 3. ...?
> 4. The universe expolodes.

Why would there be a Connect class?

class Connection : Action {}

tada!  English words can often be nounized.



More information about the Digitalmars-d mailing list