<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: How generics can pay dividends</title>
	<atom:link href="http://brian.pontarelli.com/2008/06/19/how-generics-can-pay-dividends/feed/" rel="self" type="application/rss+xml" />
	<link>http://brian.pontarelli.com/2008/06/19/how-generics-can-pay-dividends/</link>
	<description>Brian Pontarelli</description>
	<pubDate>Thu, 20 Nov 2008 10:30:08 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
		<item>
		<title>By: Brian Pontarelli</title>
		<link>http://brian.pontarelli.com/2008/06/19/how-generics-can-pay-dividends/#comment-21221</link>
		<dc:creator>Brian Pontarelli</dc:creator>
		<pubDate>Mon, 23 Jun 2008 15:56:57 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2008/06/19/how-generics-can-pay-dividends/#comment-21221</guid>
		<description>@Gabriel

I agree with respect to annotations. This is another reason I'm writing yet another MVC. Struts2 and XWork annotations are now just as bad as the XML configuration, especially for validation! JCatapult's MVC is pretty lightweight with annotations and more importantly they aren't generalized annotations like many other frameworks use. For example, Struts2 uses a single annotation for all Results including forwards, redirects, streams, xml, etc. JCatapult uses mutliple annotations such as Forward, Redirect, Xml, Stream, etc. Each annotation contains the parameters that make sense for that result type.

@Van der Shart

Yeah, everyone wants this. There is some good work going on at Sun for JDK 7 that will make generics much better in this respect. I forget the exact person working on it, but hey has some great ideas to "fix" erasure.

@Mathias

I'll definitely check out nextgen. Sounds very cool. The biggest issue will still be the single instance of a Class per Classloader regardless of the type parameters used. AFAIK the majority of the issues aren't in the compiler, but in the JVM.

@Blake

I ran into the exact same situation and since XWork and Struts are coupled to OGNL completely and I'm not an XWork or OGNL committer, I couldn't do anything about it all really. Plus, OGNL is overly complex because it is an entire expression language. I didn't need an entire EL to start, just something for setting parameters into the actions So, I wrote my own solution. The nice thing about this solution is that it doesn't use any lexer/parser and correctly handles generics, even some of the more tricky cases. If you want to take a look, check out the code from the Google code project. It is at http://jcatapult.googlecode.com/svn/jcatapult-mvc/trunk in a package named org.jcatapult.mvc.pamareter.el</description>
		<content:encoded><![CDATA[<p>@Gabriel</p>
<p>I agree with respect to annotations. This is another reason I&#8217;m writing yet another MVC. Struts2 and XWork annotations are now just as bad as the XML configuration, especially for validation! JCatapult&#8217;s MVC is pretty lightweight with annotations and more importantly they aren&#8217;t generalized annotations like many other frameworks use. For example, Struts2 uses a single annotation for all Results including forwards, redirects, streams, xml, etc. JCatapult uses mutliple annotations such as Forward, Redirect, Xml, Stream, etc. Each annotation contains the parameters that make sense for that result type.</p>
<p>@Van der Shart</p>
<p>Yeah, everyone wants this. There is some good work going on at Sun for JDK 7 that will make generics much better in this respect. I forget the exact person working on it, but hey has some great ideas to &#8220;fix&#8221; erasure.</p>
<p>@Mathias</p>
<p>I&#8217;ll definitely check out nextgen. Sounds very cool. The biggest issue will still be the single instance of a Class per Classloader regardless of the type parameters used. AFAIK the majority of the issues aren&#8217;t in the compiler, but in the JVM.</p>
<p>@Blake</p>
<p>I ran into the exact same situation and since XWork and Struts are coupled to OGNL completely and I&#8217;m not an XWork or OGNL committer, I couldn&#8217;t do anything about it all really. Plus, OGNL is overly complex because it is an entire expression language. I didn&#8217;t need an entire EL to start, just something for setting parameters into the actions So, I wrote my own solution. The nice thing about this solution is that it doesn&#8217;t use any lexer/parser and correctly handles generics, even some of the more tricky cases. If you want to take a look, check out the code from the Google code project. It is at <a href="http://jcatapult.googlecode.com/svn/jcatapult-mvc/trunk" rel="nofollow">http://jcatapult.googlecode.com/svn/jcatapult-mvc/trunk</a> in a package named org.jcatapult.mvc.pamareter.el</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Blake</title>
		<link>http://brian.pontarelli.com/2008/06/19/how-generics-can-pay-dividends/#comment-21213</link>
		<dc:creator>Blake</dc:creator>
		<pubDate>Mon, 23 Jun 2008 14:18:06 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2008/06/19/how-generics-can-pay-dividends/#comment-21213</guid>
		<description>Hey Brian,
Did you update OGNL to handle generics?  Or did you end up using something else?  When I tried to create generic actions in S2, OGNL ended up not knowing how to set the types.  Ie, I create a GetAction and a generic entity T on the object is now set with the correct params.</description>
		<content:encoded><![CDATA[<p>Hey Brian,<br />
Did you update OGNL to handle generics?  Or did you end up using something else?  When I tried to create generic actions in S2, OGNL ended up not knowing how to set the types.  Ie, I create a GetAction and a generic entity T on the object is now set with the correct params.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mathias Ricken</title>
		<link>http://brian.pontarelli.com/2008/06/19/how-generics-can-pay-dividends/#comment-21139</link>
		<dc:creator>Mathias Ricken</dc:creator>
		<pubDate>Sun, 22 Jun 2008 14:42:42 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2008/06/19/how-generics-can-pay-dividends/#comment-21139</guid>
		<description>@Van der Shart: I think everyone who uses generics wants an implementation without type erasure, but until we get that, the erasure-based generics are the best thing we have and still better than nothing. I prefer what is described by some generics antagonists as cumbersome type annotations to a rampant use of casts.

And while we are talking about generics without type erasure, perhaps you will allow me to mention NextGen, a javac compiler replacement developed at Rice University that allows first-class generics: http://japan.cs.rice.edu/nextgen/</description>
		<content:encoded><![CDATA[<p>@Van der Shart: I think everyone who uses generics wants an implementation without type erasure, but until we get that, the erasure-based generics are the best thing we have and still better than nothing. I prefer what is described by some generics antagonists as cumbersome type annotations to a rampant use of casts.</p>
<p>And while we are talking about generics without type erasure, perhaps you will allow me to mention NextGen, a javac compiler replacement developed at Rice University that allows first-class generics: <a href="http://japan.cs.rice.edu/nextgen/" rel="nofollow">http://japan.cs.rice.edu/nextgen/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Van der Shart</title>
		<link>http://brian.pontarelli.com/2008/06/19/how-generics-can-pay-dividends/#comment-21133</link>
		<dc:creator>Van der Shart</dc:creator>
		<pubDate>Sun, 22 Jun 2008 13:17:38 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2008/06/19/how-generics-can-pay-dividends/#comment-21133</guid>
		<description>I want a Generics implementation without type erasure! Till then, Java's Generics implementation is half-baked and broken.</description>
		<content:encoded><![CDATA[<p>I want a Generics implementation without type erasure! Till then, Java&#8217;s Generics implementation is half-baked and broken.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Gabriel.</title>
		<link>http://brian.pontarelli.com/2008/06/19/how-generics-can-pay-dividends/#comment-21002</link>
		<dc:creator>Gabriel.</dc:creator>
		<pubDate>Fri, 20 Jun 2008 17:02:29 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2008/06/19/how-generics-can-pay-dividends/#comment-21002</guid>
		<description>In the specific instance of Brian's examples, generics were clearly the way to go. 

Abuse of annotations is fairly rampant IMO. Use them conscientiously.</description>
		<content:encoded><![CDATA[<p>In the specific instance of Brian&#8217;s examples, generics were clearly the way to go. </p>
<p>Abuse of annotations is fairly rampant IMO. Use them conscientiously.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Pontarelli</title>
		<link>http://brian.pontarelli.com/2008/06/19/how-generics-can-pay-dividends/#comment-20993</link>
		<dc:creator>Brian Pontarelli</dc:creator>
		<pubDate>Fri, 20 Jun 2008 15:29:44 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2008/06/19/how-generics-can-pay-dividends/#comment-20993</guid>
		<description>Sure. Annotations might help out, but I'm not certain that I want to place an annotation on every field. The key is to reduce code without introducing complexity. A major reason some languages haven't taken off really big. You would have to annotate even simple primitives like this

@Integer
var age

What's the difference between that and just defining the type? Nothing as far as I can tell.

I just don't see the bad in generics. I guess I haven't been convinced that 99.9% of everyday generic usage is bad. I understand that some generics can be a little bit hairy, but that complexity is usually left to the platform and framework developers who can grok it.

The only way I could see it improving would be to make the syntax simpler and to hide complexity. The issue seemingly always comes back to type determination by tools. Can a tool determine the types in a collection? If you have a String[], can you convert it to a List&#60;integer&gt;</description>
		<content:encoded><![CDATA[<p>Sure. Annotations might help out, but I&#8217;m not certain that I want to place an annotation on every field. The key is to reduce code without introducing complexity. A major reason some languages haven&#8217;t taken off really big. You would have to annotate even simple primitives like this</p>
<p>@Integer<br />
var age</p>
<p>What&#8217;s the difference between that and just defining the type? Nothing as far as I can tell.</p>
<p>I just don&#8217;t see the bad in generics. I guess I haven&#8217;t been convinced that 99.9% of everyday generic usage is bad. I understand that some generics can be a little bit hairy, but that complexity is usually left to the platform and framework developers who can grok it.</p>
<p>The only way I could see it improving would be to make the syntax simpler and to hide complexity. The issue seemingly always comes back to type determination by tools. Can a tool determine the types in a collection? If you have a String[], can you convert it to a List&lt;integer></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Venkat Subramaniam</title>
		<link>http://brian.pontarelli.com/2008/06/19/how-generics-can-pay-dividends/#comment-20978</link>
		<dc:creator>Venkat Subramaniam</dc:creator>
		<pubDate>Fri, 20 Jun 2008 10:27:38 +0000</pubDate>
		<guid isPermaLink="false">http://brian.pontarelli.com/2008/06/19/how-generics-can-pay-dividends/#comment-20978</guid>
		<description>Good point Brian, but IMHO, I think, the moral is type information is very useful at times and should be inferred. Generics is one way to get that, and makes it useful for the purpose you've mention, but that does not necessarily make Generics good. Can you get that type information/inference in other ways, like annotations or something lightweight that may be created in the future?</description>
		<content:encoded><![CDATA[<p>Good point Brian, but IMHO, I think, the moral is type information is very useful at times and should be inferred. Generics is one way to get that, and makes it useful for the purpose you&#8217;ve mention, but that does not necessarily make Generics good. Can you get that type information/inference in other ways, like annotations or something lightweight that may be created in the future?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
