[Zope3-Users] Re: Buddydemo / coding style question
Philipp von Weitershausen
philipp at weitershausen.de
Thu Nov 18 11:48:53 EST 2004
Kent Tenney wrote:
> Howdy,
>
> I'm unsure about naming conventions.
>
> http://dev.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/ClassesAttributesMethods
>
> says::
>
> "Methods also should start with a lower case letter.
> The first word of a method should always be a verb
> that describes the action."
>
> Is this recommending;
>
> class Buddy(persistent.Persistent):
> """Buddy information"""
>
> def name(self):
> return "%s %s" % (self._first, self._last)
>
> be named;
>
> def getName(self):
> return "%s %s" % (self._first, self._last)
>
> or is the 'get' assumed?
In Zope X3, nearly nothing regarding naming conventions is assumed.
Explicit is better than implicit. (Except when it's not).
In any case, you are right, either the schema is wrong or the
implementation. Since we're talking about a method here, the convention
is that methods are always verbs, so it should be getName() everywhere.
But I agree with Fred that it maybe shouldn't be a method at all but an
accessible attribute...
Philipp
More information about the Zope3-users
mailing list