[Cubicweb] About CubicWeb >= 3.7 (potential) refactorings
sylvain.thenault at logilab.fr
Thu Feb 11 17:29:00 CET 2010
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.
> > > 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.
> > 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
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.
> > 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
> > 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).
Sylvain Thénault LOGILAB, Paris (France)
Formations Python, Debian, Méth. Agiles: http://www.logilab.fr/formations
Développement logiciel sur mesure: http://www.logilab.fr/services
CubicWeb, the semantic web framework: http://www.cubicweb.org
More information about the Cubicweb