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: looking at generic




On Oct 28, 2004, at 1:59 PM, Rolf Howarth wrote:

That's true of course. But templates (and even worse, operator overloading - uuggghh!) make it that much easier to write poorly designed code, and to write code which is difficult to understand. Even if the original design is ok, when someone else comes along and has to fix something in code using templates.

This is an area where I think the distinction between C++ templates and Java generics is important to understand. Java generics don't allow anything *new* to be done, it just allows existing or future Java code that employes the "generic idiom" (essentially using Object, or often some base interface to write code that operating independent of type) to carrying on doing exactly that same thing, only with greater static type safety.


If a particular piece of Java code was bad or good design before generics, it remains bad or good after. I do speculate however that many uses of the generic idiom which *are* bad design will provide difficult to parameterize for enhanced static type checking, and that this in fact could be used as a "smell" for flushing out such bad design in code.

-wilhelm

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Re: looking at generic (From: Rolf Howarth <email@hidden>)



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.