[Web-SIG] Re: Just lost another one to Rails
Martijn Faassen
faassen at infrae.com
Tue Apr 19 18:20:41 CEST 2005
A.M. Kuchling wrote:
> On Tue, Apr 19, 2005 at 05:31:59PM +0200, Martijn Faassen wrote:
>
>>How would you deal with the flexibility requirements that these systems
>>have, though?
>
> I have no idea what these requirements are.
Someone builds some web app or framework/app, for instance, a CMS.
Now someone else wants to extend or change the behavior of this app. For
instance, someone wants to add a new page to document objects in a CMS,
that contains some textual summary information (Word count, say). Other
people do not want or need this functionality however, so they don't
want to see this page.
A more low level scenario could be modifications to the way URI
traversal works (you hook in another adapter that knows how to look up a
subobject), without having to change the core framework.
> However, I do think that,
> if your implementation requires infrastructure that builds a whole new
> object model on top of Python, that may be a good clue that the
> implementation should be done in some other language than Python.
What new object model are you talking about? I mean, adapters and views
(they're very similar, views provide user interfaces, and adapters
developer interfaces). They're well established design patterns. Looking
up a view or adapter in some registry is also fairly common. I see this
scattered all across the Zope-based CMS I helped build, Silva, wherever
we needed the flexibility (which was typically customer project driven,
very real world all). I see them everywhere; views for content objects,
metadata set mapping to content objects, XML importer/exporter to
content objects, different behavior for binary content based on the mime
type (such as showing different icons), and I'm sure there's more I'm
forgetting..
All Zope 3 (which I know a lot better than Twisted) does with its
adapter system is provide a uniform, flexible way to register these
adapters and views and then later look them up, instead of having
hand-written registries and different lookup APIs growing all across the
system.
Are you suggesting I switch to a language with, say, multi-methods
instead, or is there another pattern to accomplish this kind of
extensibility in Python that you favor?
Regards,
Martijn
More information about the Web-SIG
mailing list