[Baypiggies] Possible talk: A Nondualist Alternative to Proxy Wrapper Theory

Ken Seehart ken at seehart.com
Sat Jun 23 14:25:52 CEST 2007


If you read my previous email that was accidentally sent here instead of 
python.org, you have some idea of what this is about.

What is new is that I did some experimenting and came up with some 
interesting results.  In fact I have implemented a proof-of-concept of 
what I describe below.

So let me know if you would like me to give a talk on this subject.


      Overview:

Anyone who has wrapped C or C++ libraries that contain methods which use 
and/or return instances of the types that are being wrapped has 
encountered what I call the /inheritance/proxy wrapper dilemma/.

The general scenario is that we have a python extension library which we 
wish to enhance by writing a python layer to add functionality and 
improve syntax.  A good example is the wxPython library.  The most 
obvious thing to do is to derive our classes from the extension types.  
This works fine until we have to deal with methods in the extension 
library that create and return instances of the low level types.  We 
want to only expose instances of our classes, not the low level objects.

At this point we do a little research and find out that we should be 
using composition rather than inheritance.  So we make a proxy system 
and inevitably wind up with a rather unwieldy pile of meaningless 
wrappers on all of our methods.  This solution is generally considered 
better than inheritance, but it creates a new set of problems.  Two 
obvious problems associated with the proxy solution are the extra 
function call overhead of the wrappers, and the necessity of generating 
piles of boilerplate code.  Also there is a tendency for the dualism 
between the proxy object and the raw object to be an ongoing annoyance.  
Once most of the bugs are weeded out, the proxy system works adequately, 
but can't really be considered fun.


      A Nondualist Alternative to Proxy Wrapper Theory:

In this talk, I will demonstrate a technique for implementing wrappers 
without proxies that nevertheless have all the desirable features that 
we expect from composition based solutions, and all the simplicity we 
had hoped for with simple inheritance.  We eliminate dualism along with 
the unnecessary run-time overhead of wrappers.  The challenge is to keep 
an open mind when faced with scary seeming violations of well 
established object oriented theory, and focus on the practical 
considerations.

Time: 45 minutes to 1 hour.  Probably not for beginner night :-)  Let me 
know if you are interested.

- Ken Seehart

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/baypiggies/attachments/20070623/56f649f0/attachment.html 


More information about the Baypiggies mailing list