[Twisted-Python] Re: Components

Phillip J. Eby pje at telecommunity.com
Fri Feb 27 10:17:44 MST 2004


At 11:17 AM 2/27/04 -0500, David Bolen wrote:

>Obviously, the ABC approach doesn't seem to be adopted by Twisted or
>PyProtocols (at least for its official interfaces) themselves, but I
>haven't really seen references to advantages of the non-ABC variant.

The main advantages I have found to the "pure interface" style are:

* Interfaces may be read as documentation, because there is no behavior in 
the way.  All that's there is just signatures and docstrings.

* It's easier to see what is *really* the expected interface, as opposed to 
an accident of implementation.

ABC's have a tendency to start out clean, but then accrete a bunch of 
implementation junk over time.  With a pure interface, there's no tempation 
to do it, since there's absolutely no benefit to putting any implementation 
in the interface.

So, if you are creating a framework of any significance, your users will in 
all likelihood thank you for using the pure style instead of the ABC style, 
unless you have exceedingly strong discipline as far as being able to keep 
implementation out of the ABC, or are separately specifying/documenting the 
expected behavior anyway.





More information about the Twisted-Python mailing list