Re: Generics and WO
Re: Generics and WO
- Subject: Re: Generics and WO
- From: Lachlan Deck <email@hidden>
- Date: Tue, 22 Aug 2006 14:23:43 +1000
Hi there,
On 15/08/2006, at 2:06 PM, Ian Joyner wrote:
Reading up on this a bit more, I note that generics are
implemented, not by changing the JVM, but by 'type erasure'. The
upside of this is that programs using genericity are able to run on
older JVMs and you still get compiler checks and are able to cast
your casts to the wind.
Downside though is that cast checks will still be done at runtime,
even though a class cast error can't occur, so there is no speed up
due to stronger typing.
Interesting...
Now I have to admit to being a bit lazy and have just been using
NSArray, NSDictionary, etc in preference to Java Collections and
Arrays, but now with genericity, the Java collection hierarchy has
a lot more going for it.
I've always preferred the NS collections as being well written,
powerful (esp in combination with KVC) and uncomplicated. NS[Mutable]
Array, NS[Mutable]Set, NS[Mutable]Dictionary provide most
functionality needed from collections.
The Java Collections don't provide immutable collections by default
and seem to have too many options of doing the same thing without
much advantage. (e.g., for Lists - have ArrayList, Vector, LinkedList
etc etc).
I gather Apple have put WO development on hold, or opened it up a
lot more. So does that mean that NS (a dumb naming convention)
structures
NS<somename> is a good naming convention. i.e., There are two things
in play that provide uniqueness to a class name - (1) the name's
Prefix and (2) the package (should the former fail). If you've used
'import' statements in your java class (which most do - and which
Eclipse and the like do automatically for you) then without the first
condition you'd be more often than not using full-package-namespaces
throughout your code which would be ugly.
with regards,
--
Lachlan Deck
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden