On 2009-07-29 10:53:59 -0400, Ary Borenszweig <a...@esperanto.org.ar> said:
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.
I'd go with "ConnectAction" to make sure there's a noun. The rule
following the "don't repeat the base class name" one is aimed at
allowing this specific usage. It says:
"""
It is fine to repeat the base type name in the derived type name if the
derived type is only a specialization having the same function:
class RemoteObject : Object { } // right
class TcpSocket : Socket { } // right
"""
Obviously it doesn't seem too well worded. Any alternative suggestion?
--
Michel Fortin
michel.for...@michelf.com
http://michelf.com/