python interfaces

Carl Banks pavlovevidence at gmail.com
Sun Jan 6 12:08:10 EST 2008


On Sat, 05 Jan 2008 23:31:02 -0800, r.grimm wrote:
> They force the user of a framework to use it in a defined way. 

This is the arrogance of the provider thinking that he can anticipate all 
the needs of the user.

Even when interfaces exist, they should be there to guide the user rather 
than to force the user.  A user should be able to refuse to implement the 
interface, if the user knows that full implmentation is not necessary, or 
dangerous.  Frankly, a lot of interfaces suck.  The user is often a lot 
smarter than the provider, and nearly always knows his needs better.  My 
sympathies in these matters are entirely on the user's side--I know 
that's very different from the philosophies of languages like C++ and 
Java.

There's a time and a place for interfaces.  Your average run-of-the-mill 
polymorphism is not it.  Usually interfaces are more of a burden than a 
benefit, especially in code that is young and still subject to lots of 
redesign and refactoring.

And ehen interfaces do make sense, such as in a plugin system or a 
complex framework, the user should be free to ignore the interface at his 
own risk.



Carl Banks



More information about the Python-list mailing list