[Zope3-dev] Allowing views to be registered for classes ratherthan interfaces.

Garrett Smith garrett@mojave-corp.com
Fri, 18 Jul 2003 12:04:42 -0500


Martijn Faassen wrote:
> Questions:
>=20
> IFoo is going to be where? Which import statement from where? There's
> also an __implements__ line you need to maintain. This is definitely
> more overhead and things you can do wrong than just remembering how
> to spell nonce. :)

Were it me, I'd throw the interface into the same module -- I'm an XPish
fan, so I like to get things working then evolve.

As far as maintaining implements(IFoo), this is the first unit test I
write.

Incidentally, this is an interesting angle. Python is so subject to
typos, etc. that if a developer doesn't write test cases ASAP -- I
*literally* mean ASAP -- he/she's going to get into trouble. This runs
counter to the notion that Python is quick-and-dirty. I find that Python
*forces* me to be a whole lot more systematic in my development than I
am in Java or C++. Unit tests take the place of compile time checking,
among providing other essentials.

So where is the hapless Zope 3 developer going to end up without a
*little* discipline? Were I teaching someone Zope 3 development, I'd
start out with a big disclaimer: "don't be lured into thinking this is a
no-brainer just because you're using Python".

> I also understood from Steve that marker interfaces won't work this
> way, as the security machinery can get into the way. It needs to be
> able to find the methods on the interface. Don't know the details
> though.=20

I don't know either. But I would argue that one way of doing something
is better than two ways -- pick the best way and don't confuse
developers with subtle options.

 -- Garrett