[Cubicweb] About CubicWeb >= 3.7 (potential) refactorings
aurelien.campeas at logilab.fr
Fri Feb 12 12:21:42 CET 2010
Le jeudi 11 février 2010 à 17:29 +0100, Sylvain Thénault a écrit :
> On 11 février 14:06, Aurélien Campeas wrote:
> > Le jeudi 11 février 2010 à 13:39 +0100, Sylvain Thénault a écrit :
> > >
> > > To make thinks clearer, when I talk about using ZCA, I'm talking about:
> > > * more Interfaces
> > > * adapters, able to turn an interface into another one
> > example of turning an interface into another one ?
> in our case, turning Folder to ITree, File to IDownloadable.
I don't get it.
> > > > If Entity namespace pollution is the main pb. to solve, couldn't reusing
> > > > the vregistry be a solution ? (as in: it would host Entity methods)
> > > > But the score-based dispatch used there maye not be fit.
> > >
> > > I don't get it.
> > which part ?
> using the registry to host entity methods.
That was a reflexion on the fact that the vregistry/select already is a
kind of generic function implementation (with score-based dispatch), and
that it could somehow be extended to host entities related functionality
(possibly with a mro-style dispatch).
> > > I get it, but imo adapters acheive the same goal and keep oop style
> > > programming, while with generic function you get down to, herr, functions.
> > Well, that's a really big plus in my book, because functions rock (and
> > they are all over the place in oop just under the plain "method" name)
> > and generic functions definitions need not be set under a Class
> > namespace to work (hence avoiding one form of object ns pollution).
> > Also we are talking about _generic functions_ here which are really all
> > about oop. They are just a nice generalisation of the concept of
> > methods.
> there *generic* but yet *functions* :) With adapters, you get the same benefits
> but you can still use OOP things such as inheritance, nicer code organization
> and so on.
generic functions are about using things such as inheritance and having
nicer code organisation, too, so I don't get your point ...
> > > Also with adapter get the additional property that if an adapter adapts
> > > IA to IB, another one IB to IC, you get IA -> IC for free. I'm not sure
> > > how you get such behaviour with generic function.
> > Since I do not understand enough about adaptation I fear I cannot follow
> > you there.
> > Can you expand a bit, for instance giving a concrete example/use case ?
> no time now, but I'll do that. I think we should take two or three typical
> use cases and see how it would be written with both solutions, with pros
> and cons.
> > > Last but not least,
> > > I like the idea of interface based programming.
> > Well, yes, I like it too. How is this relevant to the discussion ?
> adapters are all about interface based programming. I want to talk
> about IDublinCore, not the dc_description generic function (which
> is only a part of the interface).
I see nothing that would prevent us talking about IDublinCore if we
wanted too. I guess we need to get some code show to finesse some
More information about the Cubicweb