Article:
  Readable Java 1.5
Subject:   Cholesterol - WTF?
Date:   2003-09-26 11:03:07
From:   anonymous2
Response to: Cholesterol - WTF?

I think he may have been referring to the fact that static methods are not class methods at all, you cannot override them in subclasses.


Full Threads Oldest First

Showing messages 1 through 7 of 7.

  • Cholesterol - WTF?
    2003-09-26 12:33:01  anonymous2 [View]

    Static methods are not called polymorphically. They are called by the name of the class they belong to, and not by using an object that's an instance of the class they belong to. So of course they can't be overridden in subclasses. If you want a method that's overridable, simply don't make it static.
    • Cholesterol - WTF? - I want Smalltalk
      2003-10-03 22:02:31  anonymous2 [View]

      Snif sniff, all these syntax sugar sucks!
      I want Smalltalk!! ... sadly Java is so popular that I have to work with it :-(

      The need for generics is a myth, from C++.
      With today's method dispatching techniques -- like inline cache-- (researched by Sun in the Self Language) there is not really a real performance gain with generics, and static type checking.
      In fact static type checking bothers in a OO lang... one example: the need of javabeans that makes extensive use of reflection.
      I think that static type checking must be optional (like in StrongTalk... again another researh language of Sun)
      And the use of Iterators makes poor encapsulation of container objects.
      I like the Smalltalk collection aproach, with "code blocks", for example to call the "print" method in each element you can do:

      aCollection forEachElementDo: [:elem | elem print].

      note1: forEachElementDo is not language construct is a method of the aCollection instance.
      note2: [ code ] creates an instance of Block
      • Cholesterol - WTF? - I want Smalltalk
        2003-11-04 19:30:35  anonymous2 [View]

        Generics arent all good because of any potential speed increase.

        They are all good because they enforce homogeneous collections - and provide errors at compile time instead of run time. Doing run time checking to enforce homogeneity is clumsy.

        I consider them to be like exceptions, a real bonus to increasing readability.
      • Cholesterol - WTF? - I want Smalltalk
        2003-10-16 15:22:58  anonymous2 [View]

        I like the way java actually works. I don't want a foreach, and I don't like the way generics would work.
        But I like java anyway.

        If you like codeblocks you should try ruby:

        aCollection.each {|elem| print elem}

        note1 and note2 stay valid ;)
      • Cholesterol - WTF? - I want Smalltalk
        2003-10-06 15:48:25  anonymous2 [View]

        Yeah, that must be why languages like C++ and Java are on the way out and Smalltalk is making such a strong comeback. Sheesh!
        • Cholesterol - WTF? - I want Smalltalk
          2003-10-16 08:58:25  anonymous2 [View]

          He definitely has a point -- have you tried out Ruby lately? If you do, you will never want to go back to the Java or C++ world.
          • Cholesterol - WTF? - I want Smalltalk
            2003-12-20 06:43:33  anonymous2 [View]

            You will if you want your code to run fast.

            Really, folks, the issue is about the Java 1.5
            syntax proposal -- all this stuff about what
            your favorite language is or what else you think
            should be done to Java is juvenile, egocentric,
            and rude to the author. There are a thousand
            forums where you can post your thoughts on
            those subjects.

            The variance syntax looks clearly superior.
            The type syntax looks nice, as long as the
            parser can handle it, but I doubt that you
            could ever convince Sun to switch from the
            angle bracket syntax used in C++, Pizza, etc.
            The eachof syntax is rather problematic,
            looking like an operator rather than a control
            structure. It makes plenty of sense in a
            language that has full-on iterators, like CLU or
            Ruby, but for Java it's out of place. Which to
            me is an argument for leaving the foreach
            operator out of Java 1.5 altogether, and coming
            up with a proposal for a proper iterator syntax.
            The foreach operator is non-orthogonal wart that
            violates basic language design principles.