{"id":561,"date":"2004-01-29T10:50:55","date_gmt":"2004-01-29T14:50:55","guid":{"rendered":"http:\/\/wordpress.cephas.net\/?p=561"},"modified":"2004-01-29T10:50:55","modified_gmt":"2004-01-29T14:50:55","slug":"superb-article-on-generics-in-c-java","status":"publish","type":"post","link":"https:\/\/cephas.net\/blog\/2004\/01\/29\/superb-article-on-generics-in-c-java\/","title":{"rendered":"Superb article on Generics in C# &amp; Java"},"content":{"rendered":"<p>Bill Venners posted <a href=\"http:\/\/www.artima.com\/intv\/generics.html\">another great article<\/a> on <a href=\"http:\/\/artima.com\/\">artima.com<\/a>, this one the 7th in a series of conversations with Anders Hejlsberg.  If you&#8217;re not familiar with generics, Anders provides a quick introduction and then dives into explaining how C# generics were implemented and compares that implementation to Java&#8217;s implementation in Tiger.  <\/p>\n<p>Specifically, Java&#8217;s implementation doesn&#8217;t &#8220;<i>&#8230; get any of the execution efficiency that I talked about, because when you compile a generic class in Java, the compiler takes away the type parameter and substitutes Object everywhere.<\/i>&#8221; Additionally, the Java implementation loses the generic type information at runtime, which means that performing reflection on a generic leaves you with an array or a List of type &#8216;Object&#8217;, rather than the type specificed at compile time.<\/p>\n<p>One of the takeaways appears to be that the Java team made it a design goal to enable generics to run on an unmodified VM (ie: they cared about backward compatability) while the Microsoft team made their changes with knowing that they could simply release a new version of the .NET runtime, with no regard to making it backward compatible. (am I right?)  So in this case it seems that having a smaller installed base enables the .NET team to make more radical changes to their product, effectively alienating a smaller group of people than the Java team, who must consider a large install base and a large group of alienated users.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bill Venners posted another great article on artima.com, this one the 7th in a series of conversations with Anders Hejlsberg. If you&#8217;re not familiar with generics, Anders provides a quick introduction and then dives into explaining how C# generics were implemented and compares that implementation to Java&#8217;s implementation in Tiger. Specifically, Java&#8217;s implementation doesn&#8217;t &#8220;&#8230; &hellip; <a href=\"https:\/\/cephas.net\/blog\/2004\/01\/29\/superb-article-on-generics-in-c-java\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Superb article on Generics in C# &amp; Java<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/posts\/561"}],"collection":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/comments?post=561"}],"version-history":[{"count":0,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/posts\/561\/revisions"}],"wp:attachment":[{"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/media?parent=561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/categories?post=561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cephas.net\/blog\/wp-json\/wp\/v2\/tags?post=561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}