Generics Considered Harmful

Ken Arnold talks about the complexities of generics and how he doesn't feel they provide enough benefit for the complexity they add.  I have to agree, most people probably only understand the basics of generics and not the full spec which is a recipe for great confusion and the number and type of bugs that generics prevents really doesn't give much benefit.

It's odd that there's such a push towards scripting languages with no compile time type checking at the same time the Java crowd are pushing for stricter compile time type checking.  I can honestly say that in all the perl, PHP and Ruby scripting I've done that not once have I ever had a bug caused by having the wrong type of data in a variable.  Not once.  You never should if you have clearly defined what each variable's purpose is and if you haven't done that you've got problems that extend way beyond what a compiler can help you with.

UPDATE: Whoops, forgot the link.

3 Responses to “Generics Considered Harmful”

  1. JeffHung.Blog » 今日連結 (2005-07-02) Says:

    [...] cm x 5cm,不能用 2" 的,可以當天直接在旁邊巷子裡的照相館照。 Symphonious: Generics Considered Harmful – 這應該是從 Jav [...]


  2. JB Says:

    Compile time checking is GOOD (repeat with me …).
    The problem with Java is backward compatibility, and erasure and arrays as not real first class citizens … Milner’s type inference systems (and their improved derivatives) are wonderful It is a pity so few languages have adopted its approach … (Java has made it the other way around …)
    I have many times had the problem of NOT HAVING DATA on the variable with scripting languages (EL is not much better …).
    And the problem with many scripting languages (ECMAScript and Perl to name 2) is that they became unreadable too easily …
    Probably you can read and debug all of CPAN easily … I can read most Java APIs (source code) and make sense of them but much of CPAN baffles me … Please ask for some code snippets I will be too glad to send them to you …


  3. 今日連結 (2005-07-02) [JeffHung.Blog] Says:

    [...] Symphonious: Generics Considered Harmful – 這應該是從 Java Programmer 的立場看待 Java Generics,因為如果是 C++ Programmer 的話,不能接受 C++ Generics 的人老早就離開 C++ 了。:-p [...]


Leave a Reply

(Valid OpenIDs will skip moderation)

Alternatively, subscribe to the Atom feed.