in reply to How would you fix Java?

Object-oriented programming requires good generic containers for objects. But strong compile-time type checking destroys the ability to create such containers. The work-around in C++ is templates, which are ugly but safe. The work-around in Java is unsafe casting using type Object, which eliminates the compile-time checking it was supposed to support.

"You could define your own type-safe wrapper around the container" they say. Right, using cut-and-paste programming. IMHO, until Java gets true support for generic programming it is inferior to both C++ and perl..

Replies are listed 'Best First'.
Re^2: How would you fix Java?
by adrianh (Chancellor) on Apr 21, 2003 at 20:45 UTC
    Object-oriented programming requires good generic containers for objects. But strong compile-time type checking destroys the ability to create such containers

    I disagree. While many popular static type checking languages have poor mechanisms for handling generic containers, some have rather nice ones.

    For example I find Eiffel's generic classes elegant and powerful.

    It also looks likely that Java will be getting generic types in the nearish future - although I've not spent the time to see whether its a nice implementation (although pretty much anything would be better than the current ghastly casting nonsense).

    This isn't to say Java is one of my favourite languages (its not my most hated either :-)

Re: Re: How would you fix Java?
by Anonymous Monk on Apr 21, 2003 at 15:39 UTC

    Good point. The best explanation of this I've found is here.