[Grok-dev] Naming of grok.provides

Leonardo Rochael Almeida leorochael at gmail.com
Thu Oct 23 10:12:20 EDT 2008


So far "provides()" is just used for LocalUtility, right? As such,
it'll likely be in close proximity to the class declaration where it
will be embedded.

When thinking about what term to choose I tend to think of how the
code will read as a whole.

In the case "register_for(ISomething)" (or
"registers_for(ISomething"), it will likely be read closely after
"class MySomething(LocalUtility)", so it pops up in my mind as
"MySomething, a local utility, is being registered for
ISomeInterface".

The nice thing about it is that it bypasses the whole
implements/provides discussion. And in the case of utilities, this is
really all that matters. When you're using an utility, you're not
doing adaptation (explicitly), you're just asking for the C.A. do give
you the closest ISomething utility it can find.

Of course proficient C.A. users will have to understand the
implements/provides distinction eventually, but IMHO, if we can give
the above emphasis in the documentation we can avoid the concept
confusion and the explanation at this point.

Between the above options I'm +0 for  "registers_for" over
"register_for" and +1 to any of them over "provides". I also think the
former options will work better than the later even if we eventually
reuse it for other base classes than LocalUtility.

Cheers, Leo

On Thu, Oct 23, 2008 at 07:19, Thomas Lotze <tl at gocept.com> wrote:
> Sylvain Viollon <sylvain at infrae.com> schrieb:
>
>>   I don't want to troll, but I still prefer provides in fact. You can
>> perfectly get the meaning with an explanation, same as register_for.
>> People are not going to guess that directive, so you always need to
>> say: to select which interface is _provided_ by your adapter, use ...
>
> A lot of interfaces are possibly provided by the adapter, we need to
> single out one for registration. This is the whole point of the issue:
> we need a different term than "provide" to express that we single out
> one interface from all the provided ones.
>
> Thomas
>
> --
> Thomas Lotze · tl at gocept.com
> gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
> http://gocept.com · tel +49 345 1229889 0 · fax +49 345 1229889 1
> Zope and Plone consulting and development
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev
>
>


More information about the Grok-dev mailing list