Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mac OS X Java Performance



Todd Blanchard <email@hidden> wrote:

>In java if you have someObject.doSomething(argument) the method
>doSomething *must* exist. The idea that it might not is simply
>inconceivable.

On reflection, "inconceivable" may be too strong a word.

Or perhaps I should say "with reflection", since it is Java's reflective
capability that lets you call methods which may or may not exist on any
given instance.

I'm not saying it's easy to do, or pretty to write (or read).

I'm not saying it's as convenient to use as ObjC's or Smalltalk's
DoesNotUnderstand.

All I'm saying is that it's not only conceivable, it's actually possible,
to call or not call methods on Java objects depending on whether the object
actually implements the method or not.

I can even conceive of a language compiler that implemented this kind of
dynamism using Java reflection and wrote out class-files as the executable
form. Or it might instead perform source-level transformations where
necessary, which were then fed to an ordinary Java-language compiler. Sort
of a higher level of reflection (we could call it Prism). Who knows how
fast it would be, but it's still conceivable.


>Another capability DNU allows is the ability to be a proxy for some
>chunk of data in a database. Its essentially a query waiting to be
>triggered. On first invocation of DNU, the object executes the query
>and does a become: queryResults forward: aMessageContext which replaces
>itself with the results of the query and reinvokes the original
>message. Thus you get object faulting.

You can design Java classes to do this. It's not that difficult, and there
are different approaches with different tradeoffs, though it doesn't use
DNU. It could use reflection, though, if that was the approach that best
fit your tradeoffs.

-- GG
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.