Why should i use python if i can use java

Don Dwiggins dwig at advancedmp.net
Fri Jun 8 00:36:19 CEST 2001


Alex Martelli writes:
> I've posted very extensively about it, and how I prefer 'lightweight
> proxies' instead -- instances that have no state (but rather delegate
> all state, and possibly all behavior, to a singly-instanced object not
> exposed directly to client code) but are freely instantiable at need -- and
> specifically what different advantages this brings in different contexts,
> such as Python, COM, and so on.  Of all the issues, the key one is that
> LWP is more change-proof than SDP in my experience -- "there must
> be only one" is, out of all design constraints, one of those that most
> tend to change in an iteration.  Refactoring LWP's is trivial, refactoring
> SDP typically isn't.

Sorry, I guess I missed those posts.  From the above, it sounds like you
still start with an SDP-style singleton for the proxies to "point at", then
add the LWP class for users to instantiate; this is essentially a Bridge,
which fits your description of the advantages -- you allow the "state
package" to be changed while not affecting the clients and, as you also
describe, you can evolve the LWP separately (e.g., subclassing).  It looks
to me as though, rather than replacing one pattern with another, you've
created a nice composition of two patterns.  Of course, your LWPs, being
Featherweights, could be used in other ways as well.

-- 
Don Dwiggins                    "Solvitur Ambulando"
Advanced MP Technology
dwig at advancedmp.net





More information about the Python-list mailing list