On May 19, 2008, at 11:00 AM, Peter Duniho wrote:
That said, because of the existence of reflection in C# and Java, similar functionality isn't really that difficult in those languages. It's trivial to take any arbitrary class or instance of a class and invoke any arbitrary named method with an arbitrary number of arguments, immediately or later as necessary.

I would agree that in the light you've offered, the NSUndoManager offers a somewhat more compelling use case than previous examples. But it's not true that the C# or Java version would be significantly different. They would be only slightly more verbose (though yes, I admit...they would be more verbose, albeit slightly).


Something directly like NSUndoManager simply can't be done reasonably in Java. My knowledge of C# is not strong enough to make such a claim.

Java simply does not have a mechanism for "capture an arbitrary method + argument set". Any such proxy object in Java is going to have to either be a subclass of the class being proxied OR the set of methods +arguments to be captured would have to be defined in an interface. Even with such a solution in place, the developer is still going to have a lot of manual work ahead of them to provide all of the store- and-forward mechanisms for each possible capturable method. And any methods that are not to be captured are going to have to be implemented as pass through.

Sure, you could go down that path, but it would be way way beyond "slightly more verbose". It would be prohibitively more verbose.

Thus, I would expect that a solution in this space in Java would be to use a completely different pattern better suited to the statically bound nature of Java.

b.bum




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to