This post originated from an RSS feed registered with Java Buzz
by Carlos Perez.
Original Post: Programming with Adaptors
Feed Title: .:Manageability:.
Feed URL: http://www.manageability.org/blog/stuff/rssDisabled?portal_status_message=Syndication+is+Disabled
Feed Description: Random thoughts on the manageability of complex software.
We will present our project named Spin which offers a - to our knowledge - revolutionary new approach. It offers transparent thread handling with minimal impact on your application code.
Do you hate having to write lots of if-then logic to test what type something is? Wouldn't it be nice if you could just declare "I want this object to have this behavior" and magically convert whatever value you have, to the type you need? PyProtocols lets you do just that, cleanly, quickly, and robustly -- even with built-in types or other people's classes.
Spin is somewhat similar to the interceptor based approached to AOP, however it adds an adaptor to respond to events that makes it worthy of more indepth study.
PyProtocols, well this is something you really have to dig in deep. Here are some of its features:
Specify what behavior a component requires or provides
Specify how to adapt the interface provided by one component to that required by another
Specify how to adapt objects of a particular type or class (even built-in types) to a particular required interface
Automatically adapt a supplied object to a required interface, and
Do all of the above, even when the components or frameworks involved were not written to take advantage of this package, and even if the frameworks have different mechanisms for defining interfaces.
Now if you reflect a bit, you realize that a lot of menial work in programming covers the transformation of one type into another. It's just embarassing the amount of time spent doing this kind of activity. It makes so obvious the limits of Object Oriented resusability.
The reasons are also so obvious. If you continue to develop objects with different kinds of methods. Then you'll continue to need to write an adaptor that transforms one object to another, at worse the amount of progamming is like O(n^2). So we can either not define any new kinds of objects (or more precisely interfaces) or we can make programming adaptors much easier.