This post originated from an RSS feed registered with Java Buzz
by Scott Delap.
Original Post: Restoring the "Delegate" Concept To Java
Feed Title: ClientJava.com
Feed URL: http://www.clientjava.com/archives/wireless_mobile.rdf
Feed Description: Client/Desktop Related Java Development
If you are brave enough to fight through the ad jungle that is JDJ, there is an article on creating method delegates in Java. I'm not sure I see a lot of usefulness to this technique myself. As the author points out, this is not compile time safe. The quick creation of listeners is interesting as is being able to execute a method in a variety of manners by changing how you execute the delegate. I still think I'd rather see a structure created for asynchronous versus synchronous application events than to simply wrap a method and let something else execute it.
Restoring the "Delegate" Concept To Java Back in October 1996, in an attempt to eliminate the need for this bloated syntax, Microsoft introduced an object-oriented method pointer into J++ called a "delegate." Sun Microsystems, citing the delegate as language pollution, sued Microsoft a year later for violating its Java license agreement. Had the delegate become part of Java, would Swing programming be easier? Could that technique have solved many of the Swing threading headaches that we're faced with today?