Re: Educate me on generics please...
Re: Educate me on generics please...
- Subject: Re: Educate me on generics please...
- From: Chuck Hill <email@hidden>
- Date: Wed, 6 Feb 2008 20:41:47 -0800
On Feb 6, 2008, at 4:06 PM, Ian Joyner wrote:
On 07/02/2008, at 7:37 AM, Chuck Hill wrote:
On Feb 6, 2008, at 12:33 PM, James Cicenia wrote:
Well I have decided to to start going to 1.5 now.
this is something I do all the time:
NSMutableArray args2 = new NSMutableArray();
args2.addObject("portfolio");
args2.addObject(portfolio);
myQualifier2 = EOQualifier.qualifierWithQualifierFormat("%@ = %
@", args2);
NSArray results = EOQualifier.filteredArrayWithQualifier
(portfolioUserGroups(),myQualifier2);
How do I make that "generic Java 1.5" friendly?
From Art:
http://weblogs.java.net/blog/arnold/archive/2005/06/
generics_consid_1.html
Hey, I used to work with David Holmes, many a happy hour spent
discussing type systems, etc. (Well, OK maybe a few arguments as
well). He put in a tremendous effort reviewing my own book.
Objects Unencapsulated: Java, Eiffel, and C++?
The article seems to dismiss generics altogether, but it is just
the poor implementation in Java. Sun was not prepared to fix the
JVM, in fact at OOPSLA in Vancouver in 1997 I remember someone
getting up and telling Sun to "just fix the damn JVM". Sun never did.
I agree. Generics as a concept are useful. It is just that most
developer's contact with them has been either C++ or Java. Neither
is a shining example.
I'd use generics for two reasons:
* you put the type spec in once in the generic in a neat
declaration instead of clutter all over the code in the form of
type casts (which are evil and should be abolished) (hence code is
easier to change - just one change and recompile, OK refactoring
support in IDEs make that easier, but that is just solving an
introduced problem, that should not have been there in the first
place).
* errors are caught at compile time
They are mainly used to specify a least required object type in
collections.
That aspect of them is useful, even in Java. I can see myself using
that. But they can get really confusing, really fast in Java. I'll
stick to the low hanging fruit.
This discussion is rather like the one they have just had on Cocoa-
dev on garbage collection. Generics, multiple inheritance, and GC
are great ideas and done properly simplify programming, but when
hacked into something that didn't provide for them in the first
place make programming more complicated. Hence, people mistakenly
write them off. (I think the GC seems to be well done for Objective-
C and Cocoa, but the problem seems to be in its interaction with C.)
I am still not quite convinced about multiple inheritance, but I
blame that on C++. :-)
Chuck
http://www.mindview.net/WebLog/log-0050
YMMV :-)
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve
specific problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40sportstec.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
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