Slashdot Mirror


10 Reasons We Need Java 3

An anonymous reader writes "This article on O'Reilly Network (written by one of the most active Java book writers ever, Elliotte Rusty Harold) has some interesting points about the need for a new 'cleaned up' Java version, made to incorporate the advances in the last 7 years of its life and without the requirement to keep compatibility with old versions."

242 of 568 comments (clear)

  1. Forget It by JohnHegarty · · Score: 4, Insightful

    "without the requirement to keep compatibility with old versions"

    The only way this will work is if it is compatable with older versions. Would anyone upgrade to Borland Builder 6 if they were told they couldn't compile there previous programs.

    If it was compatable , then people could upgrade and start using in the morning.

    1. Re:Forget It by zmooc · · Score: 2

      I run a company that writes Java-webapps and would instantly upgrade if a new Java version would come up with the suggestions of the author. Especially the primitive types should be removed. They're so incredibly annoying. Besides, why would Borland Builder 6 not compile any older programs? It's not that hard to tell the builder what version of Java you want to use.

      --
      0x or or snor perron?!
    2. Re:Forget It by zmooc · · Score: 2

      Well...maybe they shouldn't be removed, but it should be possible to access them as normal objects. Because that's what it's all about in the end.

      --
      0x or or snor perron?!
    3. Re:Forget It by dasmegabyte · · Score: 3, Interesting

      Well, technically people are upgrading to VB .NET, which is wholly incompatible with VB 6.0. They are so different, and VB.NET is so unready as a passable alternative for application development, that I'm sure there's room in this space for somebody e.g. Borland to make a killing selling non-webservice, non-CLR based "Visual" development environments.

      A few things I've "recompiled" into VB.NET (it really is recompilation, nothing looks the same as VB.NET is a real object oriented language, or as close as it comes from redmond's "think/market-tank") look nothing like the originals. Tight loops I spent hours optimizing run five times slower. Stuff I didn't optimize is even slower than before. But I can kind of sign off on this -- it's so nice to finally have real constructors, etc.

      --
      Hey freaks: now you're ju
    4. Re:Forget It by SurfTheWorld · · Score: 5, Insightful

      From the article:
      This article imagines a "Java 3" that jettisons the baggage of the last decade, and proposes numerous changes to the core language, virtual machine, and class libraries. The focus here is on those changes that many people (including the Java developers at Sun) would really like to make, but can't -- primarily for reasons of backwards compatibility.

      In other words, Elliotte fully understands *why* his proposed changes would be difficult to implement. His 10 changes are contingent upon the assumption that you can break backwards compatibility.

      It doesn't seem totally unreasonable to me. Microsoft forces people to upgrade their OS in order to support newer versions of their Office product. While I'm definitely not a Microsoft advocate, I believe that forced upgrades aren't necessarily a "bad thing."

      Assuming Java 3.0 were implemented and backward compatibility was broken, Sun wouldn't pull the downloads for Java 2.0 off their websites. Moreover, a magical wave of energy won't wash over the planet halt'ing all Java 2.0 and 1.0 applications and permanently erasing their JDK installations. The 2.0 and 1.0 Java applications would simply become "legacy" code until such time that they are either replaced or updated to the new Java 3.0. In fact, it would not surprise me if a significant number of the apps were not migrated (because they were not judged important enough to spend money to upgrade) and continued to execute under the old Java.

      The authors of Java 1.0 and Java 2.0 applications didn't have the benefit of coding under the "3.0 conventions". If the applications they wrote could really benefit from the changes, the authors will go back and refactor. If not, the application will continue to run in it's current form for years to come.

      Upgrades are like refactorings. While toothless ones are trivial, they rarely provide significant benefit. It's usually the difficult upgrades (EJB 1.1 to 2.0?) that provide real opportunity for advancement. The 10 proposals by Elliotte seem like an example of the latter.

      --
      Do it for da shorties
    5. Re:Forget It by Jeppe+Salvesen · · Score: 2

      If they could make the JVM work with both java2 and java3, I don't think backwards compatibility would be the big issue. We would still have access to java2 compilers, but most of us would want to use java3 since it would enable coders to produce more code per hour.

      Java2 is awkward in some respects, not so awkward in other respects. It is certainly less clean now than it was when it was originally released - with all the bonus IO layers etc tacked on. Just look at the size of the source code for Java. All that backward compatibility needs to be maintained. I'd rather they cleaned things up and put their efforts into making Java3 work really well.

      --

      Stop the brainwash

    6. Re:Forget It by foofboy · · Score: 2, Insightful

      >>>>Do you use the primitive data types directly when streaming?

      >>Yes. See InputStream and OutputStream. They use primitive types

      Point taken. Let me clarify my stance. [In|Out]putStream should be implemented using hard 8 bit thingies internally, but that when I request a number of 8 bit thingies from the stream, I'd just a soon stuff them into a Byte (the object) as a byte (the primitive). But there shouldn't be Bytes and bytes. Since we are dealing with objects, lets just use objects. Needless to say, we'll need to use objects representing byte arrays, and so forth.

      >>>> there's no reason that the bytestream classes can't assume 8 bit chunks, but I like the python-esque "everything as an object" approach.

      >>There are many scripting languages that have taken this approach. Java is not a scripting language but rather interpreted. There is a difference

      I'm not sure I follow you. I can compile Python source into bytecode. The semantics of the language don't change. If you mean that Java is trying to achieve higher performance, well I'm not a compiler/VM author but the original article suggests that it's possible for the internal representation of objects to be quite close in size to their primitive counterparts (a simple matter of coding :) ). If true, and depending on the local value of "acceptible" the overhead may be acceptible.

      >>>>And, yes I have done bitwise arithmetic in both C, Java and Python.

      >>Thats good but I have no idea how this supports your point.

      I just mean that I've used all the languages, and am not comparing features of languages I'm not familiar with. I mean that I've been frustrated by the need to use Java like a half-assed C when dealing with byte sized chunks, when C's procedural approach is delightful and Python's pure object approach is delightful. Seems that they tried to provide pseudo low level access to bytes, when it might have been better to go as far down in abstraction as C or as high as python.

      >>>>However, as long as we're talking about streaming data I/O, I would love to see bytes become unsigned.

      >>Since you know bitwise arithmatic in Java you should know this is not an issue.

      Which is bigger, 0xFE or 0x01? When is 0x80 + 0x01 not 0x81? Having to manually compensate for two's complement representation gave me a big headache.

    7. Re:Forget It by dasmegabyte · · Score: 2

      Um, because sometimes morons write a huge codebase in VB using lots of string functions without considering whether strings are mutable or not? And then these guys pack up their certifications into their Saabs and leave to consult, so that us non-degree, sub 50k lackeys can support them as the application "scales."

      The particular algorithm I'm thinking of used a simple little array of shorts to store character codes which i then reorganized into a windows string. It was a damn elegant function that I've used all over the place...that's far and away my most included module. .NET "objectizes" the array and "objectizes" the shorts themselves. Suddenly, what had compiled into an itty bitty algy was a massive movement.

      And, to be honest, I don't really have to do this crap anymore with VB.Net. The StringSaver, or whatever MS called their ripoff of Java's StringBuffer class, does it all for me, no doubt faster than its recompilation of my code but slower than the one I built myself.

      VB ain't so bad if you don't make dumb mistakes like "adding" + string(s) + "and using Variants everywhere". But it's still a sloppy coder's dream. Give me Java any day of the week...except those days when I have to access the API!

      --
      Hey freaks: now you're ju
    8. Re:Forget It by Herbmaster · · Score: 2

      The only way this will work is if it is compatable with older versions. Would anyone upgrade to Borland Builder 6 if they were told they couldn't compile there previous programs.

      You are completely misunderstanding the point of the article. Your comment is not insightful (nor is it informative).

      The author is calling for a new language. This new language is a lot like Java - so much so, in fact, that it should be called Java. But it would be incompatible with Java as we know it for reasons he describes and justifies in the article. This has 3 implications, none of which are relevant to the need for "Java3" to be compatible with traditional Java:

      • New Java compilers need to support compiling Java as well as Java3.
      • New Java VMs need to support running Java as well as Java3 bytecode.
      • Development on oldstyle Java VMs, compilers, and eventually programs, should eventually stop in favor of Java3.
      --
      I'm not a smorgasbord.
    9. Re:Forget It by Wavicle · · Score: 2

      When is 0x80 + 0x01 not 0x81? Having to manually compensate for two's complement representation gave me a big headache.

      Here's an easy way to remember it:

      0x80 + 0x01 is always 0x81.

      In non two's complement, it's obvious: 128 + 1 = 129 = 0x81.

      In two's complement: -128 + 1 = -127 = 0x81

      The reason two's complement math is used is because the summation circuit for signed and unsigned values is the same. The difference circuit is only slightly different from the summation circuit - it adds a unary negation in front of the addition. But subtraction for signed or unsigned numbers is the still the same circuit.

      --
      Education is a better safeguard of liberty than a standing army.
      Edward Everett (1794 - 1865)
    10. Re:Forget It by Wavicle · · Score: 2

      I'm not sure I get your argument...

      If you are streaming data I/O, then the primitive objects would be sent as their 8/16/32/64 bit primitive representations.

      Primitive objects do not have to take up a lot more memory than primitive types. I could envision an implementation that kept primitives small until you tried to inherit from them, or wait/notify on them (something the author of the article wanted, but I think just having finals would be adequate).

      The actual memory required for an Object doesn't have to be that large. And what the author of the article really seemed to want was the ability to add a primitive to a collection without having to write 8 add() methods for each primitive or wrapping the primitive every single time. Having the compiler transparently do it all would be sweet.

      --
      Education is a better safeguard of liberty than a standing army.
      Edward Everett (1794 - 1865)
  2. Java 3?? by Jugalator · · Score: 2

    Hmm...

    "Java 1" is traditionally Java 1.1.x.
    "Java 2" is Java 1.2.x.

    "Java 3" is ...?

    Anyway, Java 1.4.x is out now. :-)

    --
    Beware: In C++, your friends can see your privates!
    1. Re:Java 3?? by Jugalator · · Score: 2

      To further add to the confusion: "Java 3" is used here at /. while the article talk about "Java 3.0" even if the current version, Java 1.4, is *way* off being Java 2.0.

      --
      Beware: In C++, your friends can see your privates!
    2. Re:Java 3?? by iapetus · · Score: 4, Insightful

      Java 2 (or 'The Java 2 Platform') is used to refer to all versions of Java since 1.2 - the idea being that the Java platform came of age at that point, having managed to absorb the major new features added in 1.1 and being ready for enterprise use. So JDK 1.2, 1.3 and 1.4 are all still Java 2.

      Given how interesting that sort of numbering approach is already, I see no additional confusion springing from the idea that Sun could declare 'Java 3' starting from JDK 1.6 - anyone who's going to get confused by these things already is. ;)

      --
      ++ Say to Elrond "Hello.".
      Elrond says "No.". Elrond gives you some lunch.
  3. 10 Reasons We Need Java 3 by af_robot · · Score: 5, Funny

    1. speed
    2. speed
    3. speed
    4. speed
    5. speed
    6. speed
    7. speed
    8. speed
    9. speed
    10. profit

    1. Re:10 Reasons We Need Java 3 by Citizen+of+Earth · · Score: 2
      Don't you mean:
      1. speed
      2. speed
      3. speed
      4. speed
      5. speed
      6. speed
      7. speed
      8. speed
      9. ???
      10. PROFIT!
  4. One big thing Java needs by Trinition · · Score: 5, Insightful

    One big thing Java needs is a multi-process VM. Think about it, how many processes does your machine run? Probably lots. How many does a Java virtual machine run? One. Each process has its own VM. While this might have some advantages when it comes to controlling crashes and security, it also means each process has the initial overhead of starting the VM and the continuing overhead of the same duplicated code running in memory for each VM.

    Startup time is not only an actual problem, but its gives a very bad impression when just launching a program takes a while. jEdit, a popular Java text editor had to overcome this by attaching to an existing server process. Kludges like this shouldn't be necessary.

    1. Re:One big thing Java needs by Westley · · Score: 2, Informative
      This is already coming in Java 1.5 (with any luck) in the form of the isolation API. See JSR 121.

      Jon

    2. Re:One big thing Java needs by jilles · · Score: 4, Informative

      In a JVM the data is all loaded classes, their on the fly compilations and many other resources that can and should be shared by java applications. Much of the overhead of starting a java application actually comes from loading and compiling classes. If you can share JVMs the classes have to be loaded only once.

      Due to the fact that the java classloader happens to be one of its cool features it is actually dead easy to implement this feature safely. Many java application launchers exist already that can let you share a jvm with multiple applications. I used several of them and was amazed at the difference in performance.

      --

      Jilles
    3. Re:One big thing Java needs by Trinition · · Score: 2

      I did look into Echidna some time ago. It looks as though development has stopped on it. A couple of things could be done to improve it because it still ain't easy.

      A multi-process JVM should basicallya llow you to run as many Java applications as you want in a single VM, and the ability to kill any particular one. They should be as easy to start as executing a normal Java program (mostly execcutable jars).

      One thing I know Echidna lacks that should be in a multi-process JVM is the concept of partitioning some things on a process boundary. System properties are for the system, but a process should be able to have properties as well, to possibly override some system properties, or have some private properties for the process to use without other processes seeing/manipulating them.

    4. Re:One big thing Java needs by tullmann · · Score: 2, Informative

      Multi-process JVMs are coming. Its called "Application Isolatation".

      JSR-121: http://www.jcp.org/jsr/detail/121.jsp

      The Expert Group is hoping to release its draft API to community review in a month or so. The draft API on the above web page is 1 year out of date, but is useful to get a handle on the scope of what's being done (if not how the API will accomplish it).

      If you can't wait, check out the JanosVM:

      http://www.cs.utah.edu/flux/janos/janosvm.html

  5. Serious features seriously needed by Anonymous Coward · · Score: 2, Insightful

    I have spent the majority of my time over the past 4 years programming Java professionally for a number of large corporate clients, mostly in the banking and telecoms sectors. While Java has certainly allowed me to increase my productivity substantially over more 'traditional' languages like C and C++, there are still a number of important features that should be included in Java 3 in order for it to fully cement it's supremacy over C/C++:

    - Multiple inheritance: some problem domains just don't map cleanly onto a single-inheritance model, and need the power that only multiple inheritance can bring. Multiple inheritance often leads to clearer code representations in the developer's head, avoiding the abstract mess present in languages like C++ and Eiffel which only kludge this feature with 'interfaces'.

    - Operator overloading: this can be a natural and productive extension for the experienced coder, and aid the junior programmer to get up to speed quickly. Again, an important omission in other languages which should be fixed

    - Pointers and direct memory access: Java currently makes it very difficult to write specific machine-targeted instructions. I find it frustrating that I can't wring out every last bit of performance from whatever CPU I'm coding for. The designers of Java really blew that one. Direct memory access with pointers like in Visual Basic and Delphi would be a godsend.

    1. Re:Serious features seriously needed by Toraz+Chryx · · Score: 3, Insightful

      I find it frustrating that I can't wring out every last bit of performance from whatever CPU I'm coding for.
      Um, isn't one of the key selling points of Java portability?, allowing programmers to write code for a specific (family of) cpus would utterly break that..

    2. Re:Serious features seriously needed by Bush_man10 · · Score: 2, Interesting

      But the beauty of java is that we don't have to directly access/manage memory. I for one would be scared to see what would happen if you gave a java programmer access to pointers when they never programmed in c/c++ before. Java does have pointers though because everythign is passed by referennce but it's all done for you. Pretty sweet actually...

      Operator overloading is an excellent way to code in c++ but I have no problems in saying Array.copy(array1, array2) myself.

      If you ask me the major problem with java is the speed issue. It will never be as fast as c/c++. But thats life...

      --
      "I believe in everything in moderation. Including moderation." -Dean DeLeo, Stone Temple Pilots
    3. Re:Serious features seriously needed by twem2 · · Score: 2, Insightful

      All these 'features' you suggest are reasons Java is better than C/C++ in my opinion.
      Perhaps multiple inheritance could be done in a sane way, but there's interfaces to avoid the need for multiple inheritence.
      Operator Overloading - This is asking for trouble. I wouldn't mind having different arithmetic operators for Ints and Reals, it would make my life easier in the long run.
      Pointers and direct memory access - ummmm, this is part of the point of Java, portable code, no direct memory access.

      I would like to see a clean up of the APIs, and threading is a bit of a mess. And making basic types proper classes would be great.

    4. Re:Serious features seriously needed by Y+Ddraig+Goch · · Score: 2, Insightful

      JAVA is not C++ nor was it ever intended to be. Does it need cleaned up? Yes. Does it need new/more features? Yes. But, then again what language doesn't. JAVA does what it does quite well, allows code to run many different platforms. All the user needs is a Java Run Time module and the code will work.

      --
      Meddle thou not in the affairs of Dragons, for thou art crunchy and with most anything.
    5. Re:Serious features seriously needed by Richard_Davies · · Score: 2, Insightful

      Java + Multiple Inhereitence + Operator Overloading + Direct Memory Access.

      Sounds like you have C++ envy. Maybe you should change languages if you really need all that. Java works quite well for most things without any of these features.

    6. Re:Serious features seriously needed by Jugalator · · Score: 3, Interesting

      I always wondered why Sun didn't make compilers for the most common OS'es. So we'd have something like this:

      Java Source -> Bytecode -> Windows .. or ..
      Java Source -> Bytecode -> Solaris .. etc.

      Not only the source would be portable, but also the bytecode, as always. No changes, just a damn bytecode compiler. Of course, the java interpreter should still be included if you for some reason didn't want to run optimized code for your CPU or had a CPU that wasn't supported with specialized native code compilers.

      The only thing that would mess things up would of course be if someone just distributed the native compiled code, but wouldn't that be just a brainless thing to do since if you included the bytecode everyone would be able to use it?

      ???

      --
      Beware: In C++, your friends can see your privates!
    7. Re:Serious features seriously needed by mark_lybarger · · Score: 4, Interesting

      java allowed you to increase productivity, substantially?

      according to this whitepaper, when developers are given their preferance of language to use to implement a solution, they're most productive. ie, someone who knows c++ and enjoys working in c++ will be just as productive as someone who knows java and enjoys working in java.

      i'd be extremely interested to see some concrete independant studies showing otherwise.

    8. Re:Serious features seriously needed by mccalli · · Score: 2
      Perhaps multiple inheritance could be done in a sane way, but there's interfaces to avoid the need for multiple inheritence.

      Well...I find interfaces to be done fairly badly, to be honest. I would like to be able to provide a default implementation for interface methods.

      Of course, once you've done that you're half-way to multiple inheritence anyway. But half-way, not the full way.

      Cheers,
      Ian

    9. Re:Serious features seriously needed by RevAaron · · Score: 2

      There already exist Java->Native code compilers. Like GCJ. It's GNU, baby. However, compiling to native code has its drawbacks as well, like breaking compatibility with certain dynamic "features" of the language.

      If you want a "faster," not cross platform language use C or Objective-C. Java isn't what you want.

      --

      Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
    10. Re:Serious features seriously needed by RevAaron · · Score: 2

      Like anyone says about any benchmark, they are rubbish. There are people out there who do a lot of straight-up numerical computing with Java. But for the majority of us who just use Java apps, real-world application performance is abysmal. That is the real benchmark. You can spout numbers all week, but it's still manages to be slow by the time it reaches the user.

      It's a good day to be a Java programmer, but a bad time to be a LimeWire user!!

      --

      Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
    11. Re:Serious features seriously needed by Jugalator · · Score: 2

      I must admit there is still a lot of work to do in this area, but once this will be addressed,
      Performance could really increase by much...


      Yeah, it use to sound like this (one day - one day!). I'm sure the JIT does an amazing job at optimizing in real-time, but I don't think it's as good as true, "precompiled", native code.

      --
      Beware: In C++, your friends can see your privates!
    12. Re:Serious features seriously needed by RevAaron · · Score: 2

      That's because Java retains a huge amount of idea-cruft that exists in C++. You still do things very much the same way- compile-run-debug. Wait, wait, wait. Get more coffee. Is it done compiling? Almost!

      Contrast this to languages like Smalltalk or Common Lisp- you don't have to recompile in the same way. You don't exit and start applications when you change a couple methods. Changes take effect then and there. With systems like these, you could easily increase your productivity.

      Java on the other hand, is C++ with garbage collection. A big deal to some C/C++ers who have been living in a hole for the last 30 years, but nothing that will double your producivity.

      --

      Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
    13. Re:Serious features seriously needed by plumby · · Score: 5, Insightful
      Multiple inheritance

      Multiple inheritance has major problems (if both superclasses have the same function, which one do you use?). A much better answer is often to use "Composition", where the class you are writing contains both of the superclasses that you want to extend, and have your class manually delegate to which ever one of the classes you want to perform the operation. See the "Inheritance versus Composition" section of "Design Pattern" for more details.

      Operator overloading

      I agree that it is a shame that this was not included. The usual arguement against them, that it's very easy to change the semantic meaning of an operator and this can confuse developers, is just as applicable to an "add" method, but I don't think it's a devastating loss to the language.

      Pointers and direct memory access:

      Ye gods. No. The moment you start doing this is the moment Java stops being cross platform, and this is a far more important feature than the extra performance that you could squeeze out of it with direct access. Since they sorted most of the performance issues out, I've rarely seen an app where there was any noticable issue in the speed of the actual java code at all (speed of DB link/RMI from overuse of EJBs are much more likely to be problems and unlikely to be sorted out with direct memory access. If you really need to do it, then write that bit in C or assembler on your native platform and call it using JNI. It's messy, but it makes sure that you really think about whether you need it or not.

      You seem to have missed the biggest C++ related ommission from Java - templates. The ability to create typed arrays using a single line is something that Java would really benefit from.

    14. Re:Serious features seriously needed by Jugalator · · Score: 2

      If you want a "faster," not cross platform language use C or Objective-C. Java isn't what you want.

      I want a cross-platform language and Java isn't what I want? The problem is that I want it to be fast too. C++ (which I also program) isn't exactly portable. Java isn't exactly fast.

      But GCJ was exactly what I was talking about. :) Interesting.

      --
      Beware: In C++, your friends can see your privates!
    15. Re:Serious features seriously needed by sunking2 · · Score: 2
      pseudo c++

      class plane {
      move()
      }

      class boat {
      move()
      }

      class flyingboat inherits plane, boat {
      if(flying)
      plane::move();
      else
      boat::move();
      }

      Nice and simple. interfaces and abstract classes to do the same is not nearly so quick
    16. Re:Serious features seriously needed by RevAaron · · Score: 2

      Java is "slow" because it's cross-platform. That, and it's poorly designed. It's possible to have a fast Java-like langauge (they exist, but they're not Java!), but Java itself won't be until maybe this fabled java 3 comes out.

      I hope GCJ is everything you hoped it to be. :)

      --

      Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
    17. Re:Serious features seriously needed by ranulf · · Score: 2
      You seem to have missed the biggest C++ related ommission from Java - templates. The ability to create typed arrays using a single line is something that Java would really benefit from.

      I like templates, but in this specific instance, part of the idea is that Java storage containers (arrays, lists, etc.) can hold any object. You want just arrays of X? Well, just unconditionally cast to X when you retrieve the elment.

      Although the excessive casts in Java do annoy me a bit. Do we really ugly code like this:

      Vector v = new Vector();
      Integer x = new Integer(42);
      Integer y = (Integer) v.elementAt(0);

      there's far too much redundancy in all these declarations. The compiler should accept implied casting from Object to any type of object if the L-type of an assignment is already known. Admittedly, you'd still need a cast for things like:

      int x=((Integer)v.nextElement()).parseInt();

      But templates are extremely flexible, for instance allowing you to have an array indexed by some arbitrary object, etc. Also, templates mean that you end up without the need to check object type at run-time and reduce the requirement to have an anonymous Object type.
    18. Re:Serious features seriously needed by toriver · · Score: 2

      That particular example is easily addressed using delegation to instances of the "superclasses". You can even expose the delegates if you wish, for the sake of typing, e.g.

      class flyingboat {

      private boat boatPart = new boat() { // Possible overriding of "boat" behavior here, with full access to flyingboat features
      };

      public boat asBoat() {
      return boatPart;
      }

      }

      Just because you can't do it in EXACTLY the same way as language X doesn't mean Java needs to adapt the particular semantics of language X.

    19. Re:Serious features seriously needed by toriver · · Score: 2
      Java on the other hand, is C++ with garbage collection.

      I thought it was "Managed C++" in .Net which was that... :-)

    20. Re:Serious features seriously needed by thomas.galvin · · Score: 2, Interesting

      Multiple inheritance has major problems (if both superclasses have the same function, which one do you use?). A much better answer is often to use "Composition", where the class you are writing contains both of the superclasses that you want to extend, and have your class manually delegate to which ever one of the classes you want to perform the operation. See the "Inheritance versus Composition" section of "Design Pattern" for more details.

      Composition is, IMO, a cludge. One of the promises of OO is code reuse; I shouldn't have to do inordinant ammounts of work to get at functionality I have already written. As for the diamond problem you mentioned, the solution is simple; if more than one parent class implements a function, force the child class to implement it's one, even if all it does is call ParentName.func();

    21. Re:Serious features seriously needed by toriver · · Score: 3, Interesting
      You seem to have missed the biggest C++ related ommission from Java - templates.

      Coming in J2SE 1.5, by all accounts. A "preview" compiler implementation is available from developer.java.sun.com.

    22. Re:Serious features seriously needed by lgraba · · Score: 2

      Java on the other hand, is C++ with garbage collection. A big deal to some C/C++ers who have been living in a hole for the last 30 years, but nothing that will double your producivity.

      I wholeheartedly disagree with this statement, because you are making a gross simplification. I am much more productive with Java than with C/C++ (I know both well), and for many more reasons that just garbage collection. These reasons are:

      - a comprehensive, well-thought out library. For instance, doing sockets programming in Java is MUCH more straightforward than in C or C++. The same functionality can be had in C++ with some outside libraries, but this is not a standard library. This is true with many more aspects.
      - built in threads support that is much easier to use than POSIX threads.
      - excellent support for distributed programming with RMI and CORBA, and both are standard.
      - Better exception handling
      - Easier building. I don't know how many hours I have wasted trying to compile and link libraries (such as ACE/TAO) completely under C/C++. I especially like when I get unresolved link errors, but no clue on where I might find these functions. With Java, if I have a missing class, the fully qualified name (i.e. package name) usually indicated where the class should be found.
      - Excellent documentation of the libraries. I am much more confortable using the JavaDoc-generated Java documentation than doing man ???? on function calls in C++. If I am using a library feature of Java that I have not used before, the J2SE documentation is usually sufficient for me to figure out what classes to use, the the usage patterns for the classes usually intuitive.

      Adding a garbage collector to C++ would not even cover 10% of the improvement Java provides over C++, from a productivity standpoint.

    23. Re:Serious features seriously needed by RevAaron · · Score: 2

      Don't tell me, tell the guy who said you weren't more productive. :)

      --

      Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
    24. Re:Serious features seriously needed by a_n_d_e_r_s · · Score: 2

      Well, it's shows that you do not know what you are talking about.

      Threads and processes uses the same internal kernel structure in the Linux Kernel so for an outsider it may look like a new process but in reality the threads all share the same memory adress space. That way one don't need new programs to look at threads but can use the normal tools to examine processes to look at the threads. Genious is it not.

      So maybe you should have analysed it a more thourough than giving up once you came to an uninformed and false conclusion.

      BTW You should have looked at the IBM JVM as it probably would have been faster.

      Also if the time differences are as huge as you claim it should've been easy to find out what really caused them.

      --
      Just saying it like it are.
    25. Re:Serious features seriously needed by renoX · · Score: 3, Insightful

      > Multiple inheritance has major problems (if both superclasses have the same function, which one do you use?).

      Well, in well-defined language (Eiffel), this isn't a major problem: the developer have to solve by hand the conflict and that's all.

      > >Pointers and direct memory access:
      > Ye gods. No. The moment you start doing this is the moment Java stops being cross platform.

      Pointers and direct memory access are two different thing.
      Pointers in themselves can be used without preventing cross platform portability.
      As for direct memory access, it's true that it is against portability, so what?
      JNI are also non-portable but it doesn't mean that we should totally get rid of JNI.

      As for the end, I agree: the lack of template in Java is quite annoying.

    26. Re:Serious features seriously needed by arkanes · · Score: 2

      You know, I can't honestly see how there's any real problem with MI - at least not from a technical standpoint. I can think of at least a couple ways to specify which base class method to use right off the top of my head, including having it specified by the order you declare the inherits, or requiring it to be explicitly declared if there's a conflict (in fact, no reason you can't use both these methods, based on your compiler settings). MI is a handy way of addressing some problems, and inheritence, in my experience, is nothing more than a formal declaration of reimplementation.

    27. Re:Serious features seriously needed by Jugalator · · Score: 2

      Ok, I think I understand the problem better now - thanks. It was also sort of the answer I expected... Sun might not have the resources to develop and support several different low-level compilers. :-/

      --
      Beware: In C++, your friends can see your privates!
    28. Re:Serious features seriously needed by Hard_Code · · Score: 2

      "I always wondered why Sun didn't make compilers for the most common OS'es."

      Maybe because they already burn lots of money giving Java away for free to ungrateful people who then go and build an industry on it. Sheesh. Write your own native compiler for <your favorite CPU>. Or use GCJ. Or use .NET.

      --

      It's 10 PM. Do you know if you're un-American?
    29. Re:Serious features seriously needed by pmz · · Score: 2

      ...someone who knows c++ and enjoys working in c++ will be just as productive as someone who knows java and enjoys working in java.

      This is very largely true, given the learning curve for any complex system.

      Another issue when choosing a language is the requirements for the software. Each language may lend itself well to a different problem, with dramatic results. Both Java and C++ are extremely versatile, but it would be a stretch to say they are "one size fits all."

    30. Re:Serious features seriously needed by puppetluva · · Score: 2

      Guys,

      Java 1.4 has a feature called Generics and it solves the same problem you want to use templates for. It solves the casting issue and is very powerful. Please read the spec (or spec summaries) to learn about generics.

      A brief, brief description of generics is: You can programmatically force a collection or set to only deal with one type of object. That collection thereafter will not accept objects that are not of that type and you don't have to explicitly cast the objects you pull out of it.

      Generics save a lot of time. Java didn't invent them, but sure has them now, so we should gripe about something else.

    31. Re:Serious features seriously needed by Prior+Restraint · · Score: 2

      I would like to be able to provide a default implementation for interface methods.

      What you want is an abstract class.

    32. Re:Serious features seriously needed by axlrosen · · Score: 2

      Several other companies have done this. It seems to make some things faster and some things slower. Overall, the cost doesn't seem worth the moderate speedup in some apps. See this report.

    33. Re:Serious features seriously needed by RevAaron · · Score: 2

      That's exactly my point. There's nothing inherent to cross-platform languages that would make it slow- perhaps it's not a good example, but Smalltalk applications usually perform better from an end user perspective. They don't "feel" sluggish. They do poorer than Java in numerical benchmarks, but as we all know, benchmarks are rubbish.

      However, due to the very costly effort to get a native-code cross platform language that performs as well as C++ which was written without regard to portability is possible. Very portable C++ code tends to be slower than if it were written against some "native" API, because there are additional layers to produce compatibility.

      It wouldn't be so much of an issue if the platforms in question were just different hardware (CPU) platforms running the same OS. OpenStep is a great example of this. very strictly controlled API between different versions of the OS targeted for CPUs- SPARC, x86 and 68k. Just a series of checkboxes for what CPUs you wish to compile.

      It could be true with Linux as well, however running Linux/PowerPC I've encountered quite a few problems recompiling just C or C++ applications that are supposed to be portable. Poorly written, yes, not intrinsic to C/C++. With a system like OpenStep though there is a lot more thought and control of the API between platforms.

      There are versions of SMalltalk which compile to the native hardware, but like Java you stand to loose certain dynamic features of the language. There are ways around these problems though. And quite a few Common Lisp implementations- just as dynamic as Smalltalk- do get around them.

      --

      Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
    34. Re:Serious features seriously needed by alext · · Score: 2

      Really? I use Borland JBuilder and WebLogic Workshop - both 100% Java GUI apps, and performance is fine. Actually, JBuilder 4 performance was fine 2.5 years ago on a Pentium 266 with Java 1.2.

      And of course on the server side (servlets vs. CGI) there's no contest.

    35. Re:Serious features seriously needed by mccalli · · Score: 2
      What you want is an abstract class

      No...because then you'd need multiple inheritance again.

      Cheers,
      Ian

    36. Re:Serious features seriously needed by Anonymous+Brave+Guy · · Score: 2
      Java 1.4 has a feature called Generics and it solves the same problem you want to use templates for. It solves the casting issue and is very powerful.

      It solves a casting issue with container classes. It's nowhere close to the power of C++ templates, or the equivalents in many other languages with good compile-time type-deduction systems.

      Please read the spec (or spec summaries) to learn about generics.

      I read it in full when it was first published, and rapidly formed the opinion that while it did solve a useful and common problem, it was mostly hype to cover up a serious omission in Java. I read it again some months later to see if it had improved. I'm afraid it hadn't. Have they now fixed it to cover more than just container classes?

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    37. Re:Serious features seriously needed by cartman · · Score: 2

      > Pointers and direct memory access: Java
      > currently makes it very difficult to write
      > specific machine-targeted instructions. I find
      > it frustrating that I can't wring out every
      > last bit of performance from whatever CPU I'm
      > coding for. The designers of Java really blew
      > that one. Direct memory access with pointers
      > like in Visual Basic and Delphi would be a
      > godsend.

      The _very point_ of java is _never_ to do this!! If you want to use direct access to optimize every last clock cycle, don't use java!

    38. Re:Serious features seriously needed by Prior+Restraint · · Score: 2
      What you want is an abstract class

      No...because then you'd need multiple inheritance again.

      Whoops! I missed that part of the comment. I've been interviewing candidates for an entry-level Java position, and "Tell me about the difference between an interface and an abstract class" is one of my staples. I guess I have that question on the brain.

    39. Re:Serious features seriously needed by cartman · · Score: 2

      The article that you cited was extraordinarily biased in favor of C++.

      There is a great deal of independent research showing that equivalent programmers are more productive in Java over C++.

      The cited article indicates that it takes the same amount of time to _write_ a program in C++ or Java, but the article dismisses the amount of time it takes to debug those programs. The article admits that debugging memory leaks is nasty and time-consuming, but states that "tools exist to help the programmer with this."

      Those tools do not remove the problem. Debugging memory leaks is incredibly time-consuming. Notice that a many commercial products _ship_ with a great many active memory leaks. Even some operating systems have them (Irix 5).

    40. Re:Serious features seriously needed by Anonymous+Brave+Guy · · Score: 2
      There is a great deal of independent research showing that equivalent programmers are more productive in Java over C++.

      Cite, please? I've heard lots of people say this, but never yet seen any, other than from obviously pro-Java groups.

      The cited article indicates that it takes the same amount of time to _write_ a program in C++ or Java, but the article dismisses the amount of time it takes to debug those programs. The article admits that debugging memory leaks is nasty and time-consuming, but states that "tools exist to help the programmer with this."

      Well, that is true, and those tools often cut the time taken to fix a memory leak down to minutes or seconds. That said, something that rang very true in the cited article was that Java tends to be more productive for less experienced programmers, then C++ catches up and overtakes it as programmer experience goes up.

      Certainly the average C++ programmer does plenty of dumb things (like using raw pointers and arrays, new and delete all over the place, etc) that a more experienced programmer would simply avoid altogether except in the low-level code where they're justified. That same more experienced programmer is probably smart enough to put in lots of diagnostics to make sure his low level code is rock solid, and as a consequence of these arrangements, he'll usually suffer from no resource leaks at all. In the usual great irony, a less experienced programmer would be more confident in his skill, and probably litter his code with bad style, leading straight to the sort of bugs that Java would prevent.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    41. Re:Serious features seriously needed by cartman · · Score: 2

      > Well, that is true, and those tools often cut the time taken to fix a memory leak down to
      > minutes or seconds. That said, something that rang very true in the cited article was that
      > Java tends to be more productive for less experienced programmers, then C++ catches up
      > and overtakes it as programmer experience goes up.

      I'd be quite surprised if C++ programmers would ever _overtake_ Java programmers in productivity. The biggest difference between the two languages is that Java manages some things for you (garbage collection, etc).

      > Certainly the average C++ programmer does plenty of dumb things (like using raw pointers
      > and arrays, new and delete all over the place, etc) that a more experienced programmer would
      > simply avoid altogether except in the low-level code where they're justified. That same more
      > experienced programmer is probably smart enough to put in lots of diagnostics to make sure his
      > low level code is rock solid, and as a consequence of these arrangements, he'll usually
      > suffer from no resource leaks at all. In the usual great irony, a less experienced programmer
      > would be more confident in his skill, and probably litter his code with bad style, leading
      > straight to the sort of bugs that Java would prevent.

      I don't buy the the argument: "I have experience, so my programs don't have those bugs." I have never met a programmer with sufficient experience to write large, complicated programs that are correct on the first try. Garbage collection eliminates an entire class of bugs automatically. You state the the programmer could put in "lots of diagnostics" to make sure that there are no memory leaks, but even this takes programmer time.

      The "usual great irony" you mention is absolutely correct: inexperienced programmers are far more confident in their ability to write bugless code.

    42. Re:Serious features seriously needed by Tablizer · · Score: 2

      (* when developers are given their preferance of language to use to implement a solution, they're most productive *)

      Edward Yourdon's surveys also seemed to suggest this. When OOP was mostly the domain of people who used OO because they liked it (before it was "in"), OOP projects scored better than average on satisfaction surveys. However, when OOP became "mainstream", it's rates plummetted to average, and seemed to stay there for the observation period.

      People think differently. Unless it can be shown that there is One Right Way to think and organize complex software, it would be fair to assume that different philosophies and techniques will favor different minds.

      I wish there was more research into this rather than One Size Fits All thinking that now exists.

  6. 0. by Perdo · · Score: 2, Funny

    10. Delete all deprecated methods, fields, classes, and interfaces.
    9. Fix incorrect naming conventions.
    8. Eliminate primitive data types.
    7. Extend chars to four bytes.
    6. Fix threads.
    5. Convert file formats to XML.
    4. Ditch the AWT.
    3. Rationalize the collections.
    2. Redesign I/O.
    1. Redesign class loading from scratch, this time with human interface factors in mind.

    If he's so prolific, and knows exactly what it needs...

    0. Do it himself.

    --

    If voting were effective, it would be illegal by now.

  7. Compatability requirement by davecb · · Score: 2

    I noted in a comment to the initial article
    that compatability is a requirement, but
    that incompatable features can be added and
    old ones phased out...

    Thus ia actually a solved problem from
    before Unix was written: I learned it from
    a Multician.

    --dave

    --
    davecb@spamcop.net
  8. backwards compatible by bsDaemon · · Score: 5, Insightful

    If people start writing for new java, then people with old java shall get cut out -- the Windows users, more than likely. They are going to have to get new java on there own, and i'm not sure how many people want to. However, they will likely have .NET forced on them anyway. New Java will just encourage use of C# unless it remains backwards compatible.

    1. Re:backwards compatible by greenrd · · Score: 2
      No, you're confusing backwards compatibility with forwards compatibility - the ability to run apps developed for a newer API. No version of Java is forwards compatible, so the problem you mentioned already exists.

      What this article is talking about is breaking backwards compatibility, which means you wouldn't be able to run J3 apps on J2 VMs. This is not so much of a problem for users since they can just use old VMs, It is mainly an issue for developers not users, and non-stupid developers are not going to choose between platforms based on whether they have to click a few times to download a new development kit or whether it's already installed.

  9. The Smalltalk way about numbers is right by r6144 · · Score: 3, Interesting
    Removing unsigned types is a good idea when doing computation, so that bad code like unsigned i; for (i = count-1; i >= 0; i--) foo(i); won't happen. However, it is a Bad Thing when doing I/O --- I have to use Long, or use some even more kludgy ways.

    So I say the Smalltalk way is easier to use, there is only one integer type when doing computation, yet I can do I/O with integers in all formats I want (8-, 16-, 32-, or 64-bit, signed or unsigned, big-endian or little-endian). If high performance is required, maybe C-like types can be added too, used only in speed-critical things.

    1. Re:The Smalltalk way about numbers is right by Creepy · · Score: 2

      Actually, he probably is talking about a compiler optimized divide by 2, not hand coded. All compilers I know of do this for you these days.

      Another thing that could cost cycles is a bad compare guess in the pipeline (something you don't need to do for unsigned), which would result in a pipeline flush.

      It does add up, but not enough that most people outside of academia and government would care. This used to be significant in games, but now most games use parallel floating point calls (floating and integer units run independently) or high speed multimedia extensions, so its importance there is very much diminished. I remember this being meaningful when I wrote a (not very pretty) flight sim about 8 years ago, but wouldn't worry about it at all, anymore (for a flight sim, at least).

  10. Who would benefit? by joe_fish · · Score: 2, Insightful
    Not Sun, many people would take the time to jump to C# rather than Java3

    Not the users. IN GENERAL the cost the rework would be greater than the cost of the benefits of additional clarity.

    I think the only real beneficiaries would be the Book authors, who would make a killing from killing trees to feed the poor confused users.

    Now I wonder which camp ERH comes into...

    1. Re:Who would benefit? by pmz · · Score: 2

      Not Sun, many people would take the time to jump to C# rather than Java3

      This isn't true. There is no advantage to migrating to C# over a new version of Java. The amount of work to move to a Java 3 would be substantially less than moving to C#. Note that the article mostly talks about just stripping out deprecated material from the Java API and cleaning things up. A few of the points are major changes, but they shouldn't cripple most Java-based projects.

      Not the users. IN GENERAL the cost the rework would be greater than the cost of the benefits of additional clarity.

      An introduction of a Java 3 doesn't mean Java 2 just dies off. Sun will have to support both for several years. Existing projects can go on as if nothing changed, and new projects can start with the latest version of Java.

      This is nothing new to software development. Just be thankful that Java has been pretty non-volitile over the years. Compare this to Microsoft's tendency to put its tools through a two-year turnover cycle.

    2. Re:Who would benefit? by joe_fish · · Score: 2
      Well there will be an easy way to see who is right. If Sun does do Java 3, and people switch to it then I guess you will be proved right. Until then I think the C# jump is close enough to keep Sun away from Java 3, and the re-write cost enough to keep the users from being happy, which will also keep Sun away.

      Note Java 3 = "new version of Java that is not compatible with Java 2" for the purposes of this debate. This is NOT the way Sun names things though. Java 2 is fully backward compative with Java so the title is somewhat deceptive. Sun use major versions in the JDK to denote compatibility.

  11. The "most controversial" proposal by CaptainAlbert · · Score: 4, Insightful

    Number 8 -

    > Eliminate primitive data types.

    > This will undoubtedly be my most controversial
    > proposal, but bear with me.

    I can agree with almost every other proposal in this article, but he's right - this one will cause a fracas.

    > I am not talking about removing int, float,
    > double, char, and other types completely. I
    > simply want to make them full objects with
    > classes, methods, inheritance, and so forth.

    One word - ew!

    > This would make Java's type system much
    > cleaner. We'd no longer need to use type-
    > wrapper classes to add primitives to lists and
    > hash tables. We could write methods that
    > operated on all variables and data.

    What you really need is generics (as in C++ templates). Java collections are vile, since they suffer from type loss even when used with "real" objects. I'm surprised that didn't come into this top ten; it's a major language deficiency.

    > All types would be classes and all
    > classes would be types. Every variable, field,
    > and argument would be an instance of Object.
    > Java would finally become a pure object-
    > oriented language.

    However, that wouldn't make all Java programs "object-oriented programs", nor would it make all Java developers "object-oriented programmers". I have a suspicion that it might impact things like the JNI too.

    > Programmers in each environment need a language
    > tailored for them. One size does not fit all.

    <ahem> Quite. That's why you don't start an exercise in OOD by deriving everything from "TObject". :)

    --
    These sigs are more interesting tha
    1. Re:The "most controversial" proposal by Westley · · Score: 5, Informative
      What you really need is generics (as in C++ templates). Java collections are vile, since they suffer from type loss even when used with "real" objects. I'm surprised that didn't come into this top ten; it's a major language deficiency.

      The article was about what can't be built on top of Java2. As Java2 (in 1.5) will be getting generics, I'm not surprised this was left out of the article. I believe there may well be some automatic boxing if you wish to use it, e.g.

      List<Integer> x = new List<Integer>();
      x.add (5);

      but it's all up for debate at the moment of course...

      Jon

    2. Re:The "most controversial" proposal by davecb · · Score: 2, Interesting

      > This would make Java's type system much
      > cleaner. We'd no longer need to use type-
      > wrapper classes

      Actually Smalltalk solved this problem
      by always executing the machine code
      primitive for, for example, integer add.
      If this failed an assertion, it faulted out
      to the more general class code.

      Substantially the same thing could be done for
      Java, so that one could have full generality
      without a performance penalty.

      --
      davecb@spamcop.net
    3. Re:The "most controversial" proposal by jtdubs · · Score: 5, Insightful

      > One word - ew!

      Why ew? Because of your limited programming experience with languages where this was eschewed?

      In general, in computers, closure is a good thing. Ask any functional programmer. Ask any language theorist. Closure is good. To simplify closure, I am referring to having rules that don't have exceptions. Having a uniform representation for as much as possible.

      In LISP data and code are stored the same way, as lists. This is the ultimate closure. Other languages implement other closures like having all data types be of a common type.

      > What you really need is generics (as in C++ templates).

      Lord God NO! Don't you EVER use C++ templates as an example of generics again. C++ templates are an attrocity. What you want is generic methods with multiple-dispatch. Look at Lisp's CLOS, or Dylan.

      > However, that wouldn't make all Java programs "object-oriented programs",

      Explain? How can you write a Non-OO program in a Pure-OO language? Cause, you see, it's not possible. You can write a program that isn't in the OO style that you think of when you think of OO. But you can't write a program that has data that isn't an "object" in a Pure-OO language.

      > I have a suspicion that it might impact things like the JNI too

      JNI would be as fine as it is now (yuch). Even the "float" class has to have an internal variable that actually stores the float.

      Justin Dubs

    4. Re:The "most controversial" proposal by mindriot · · Score: 2
      > What you really need is generics (as in C++ templates).

      http://www.cis.unisa.edu.au/~pizza/gj/

      This was intended to be added into Java, I suppose it hasn't (haven't checked 1.4 though).

    5. Re:The "most controversial" proposal by affenmann · · Score: 3, Interesting

      > What you really need is generics (as in C++ templates).
      >Java collections are vile, since they suffer from type loss
      > even when used with "real" objects. I'm surprised that didn't
      >come into this top ten; it's a major language deficiency.

      I couldn't agree more. In fact, there is a proposal (from Sun in 2001 based on Generic Java) to do just this. I really hope it will find its way into Java soon, since Generic Java solves exactly the problem you are rightly complaining about.

      Java does not need just to incorporate the advances in the last 7 years, but rather the advances (e.g. in type systems) of the last 20 years.

    6. Re:The "most controversial" proposal by Richard_Davies · · Score: 2, Interesting
      > What you really need is generics (as in C++ > templates). Java collections are vile, since they > suffer from type loss even when used with "real" > objects. I'm surprised that didn't come into this > top ten; it's a major language deficiency. I can think of 2 reasons why they weren't in this article:

      Generics will will be included in Tiger (1.5)

      They don't break either source or binary compatibility (at least not the way Sun is going to do them).

      You can even download the beta compiler and give it a whirl if you're eager. Java Generics

    7. Re:The "most controversial" proposal by CaptainAlbert · · Score: 5, Interesting

      > > One word - ew!
      > Why ew? Because of your limited programming
      > experience with languages where this was
      > eschewed?

      Nope, just flamebait :)

      > Explain? How can you write a Non-OO program in
      > a Pure-OO language?

      I'm not sure what your question really is here, and you seem to have answered it yourself. You can take your problem, use structured design / functional decomposition to come up with a solution circa 1980, then implement it in Java much as you would do in C. A single class, with many methods and members (hell, make 'em static while you're at it)... no polymorphism, no inheritence, no data hiding, no application-level abstraction.

      You can go one step back up the ladder and pretend to be using Pascal/Modula2/Ada, using classes as abstract data types and providing simple access functions. Still not what most people would call an "object-oriented" program.

      Remember, design *is* programming. A program which deliberately avoids the object-oriented features of its implementation language cannot be called OO just because it "contains objects". A good language is one which allows the programmer to express him/herself in the most suitable way for the problem being solved. If a developer has to find "ways around" a particular feature of the language, then that language is flawed.

      Me? If I was asked "what is the most harmful programming construct", I would choose type casts every time - yes, even over gotos and pointers.

      As you've probably guessed, I like C++. I tried Java and didn't like it. Therefore, I am just ranting bitterly and should be ignored at all costs. :))

      --
      These sigs are more interesting tha
    8. Re:The "most controversial" proposal by CynicTheHedgehog · · Score: 2

      I don't think getting rid of primitives is realistic. What would you use to index arrays with? Objects? So arrays would inherently be hash maps? What kind of performance impact would that have?

      Furthermore, Java doesn't support operator overloading. I don't think it should, and I hope it never does. Converting primitives to objects would make such a kludge necessary, making what now seems somewhat inconsistent seem totally inconsistent.

      And like you said, this would probably have a major impact on things like CORBA and JNI, since primitives are a part of IDL.

    9. Re:The "most controversial" proposal by jtdubs · · Score: 2

      I think this is a problem of terminology.

      A program that "contains objects", and is composed entirely of said "objects" CAN be considered OO, no matter what.

      Style has nothing to do with classification.

      Whether you use data-hiding, inheritance, encapsulation, polymorphism, [insert OO buzz-word here], is up to you.

      It's still OO if your language is Pure-OO. That's what the name Pure-OO means for god's sake.

      Yes, it might not be good OO-style. It may not be XP. But, good OO-style and XP are both fads. They have only been around for a few years and probably won't be around in the same form in a few more.

      You can't say something isn't transportation because it doesn't get you to your destination the way you want to get there. It's transportation as long as it gets you there.

      But, I do understand your point about Pure-OO languages not necessarily leading to GOOD OO programs. And I agree whole-heartedly. No language can make you a good programmer.

      Justin Dubs

    10. Re:The "most controversial" proposal by jtdubs · · Score: 2

      I still disagree.

      You CAN'T write a structured procedural program in a Pure-OO language like java without having those procedures be class methods.

      Since all of your procedures are now class methods, your program is in a object, and hence, object-oriented.

      You CAN NOT write a NON-OO program in a PURE-OO language. It CAN NOT BE DONE.

      It may not be the style of OO that you are used to. In fact it may very well be a dirty hack of reimplementing a procedural program in an OO language with the least amount of code change possible.

      It may be all public and disobey every rule of good OO design you've ever learned.

      But, if it's composed of nothing but classes with methods, then it's Object Oriented. This is just a fundamental definition of the term Object Oriented as meaning comprised of Objects where objects are instances of classes. And in C++, yes, classes are very similar to namespaces, which are just buckets for methods and variables, but, guess what, that's all classes are too.

      Again, it's a terminology problem. It's the difference between an OO program and a program written in a OO style. You MUST write an OO program when using a pure OO language. But you need not use OO style. You can write OO programs in a non-OO style. You cannot write non-OO programs in a pure OO language.

      Justin Dubs

    11. Re:The "most controversial" proposal by swillden · · Score: 2

      A program that "contains objects", and is composed entirely of said "objects" CAN be considered OO, no matter what. Style has nothing to do with classification. Whether you use data-hiding, inheritance, encapsulation, polymorphism, [insert OO buzz-word here], is up to you.

      Excuse me, sir, but you have no clues.

      Different approaches to software design exist not because it's cool or fun to have them, and in spite of what the cynics say, not even just to make money for those that promulgate them. They exist to make software development more manageable.

      All those OO "buzzwords" you mention are precisely the reason that OO was invented. Most of those concepts predate the "OO" languages, and good programmers used many of them prior to the existence of the languages. Good programmers still use them when writing programs in, for example, C. The OO languages came along later, because writing OO code in a non-OO language requires you to do a lot of bookkeeping yourself, which clutters the code and reduces the benefits.

      The same holds for structured programming. x86 Assembler is not a structured programming language, but you most certainly can write structured code with it. Or OO code.

      These design approaches are all about structuring your code in particular ways in order to make it more maintainable, flexible, extensible, etc. The implementation language is irrelevant, other than insofar as some languages take care of some of the scutwork for you, and others don't.

      If you write a stinking mess of spaghetti code in Java, C++, Eiffel, Smalltalk, CLOS, etc., your code is not OO. Spaghetti code in Modula-2, Ada95, etc, is not structured. An OO structure is OO whether implemented in C, Assembler, or C++.

      Oh, and one semi-obscure nit: Inheritance has nothing to do with object orientation. Inheritance is a common implementation approach that many (but not all) OO languages use to provide polymorphism and/or generalization/specialization. For example, inheritance is the only language-supported way to achieve polymorphism in C++ and Java, but isn't necessary for polymorphism at all in Smalltalk-style languages. Inheritance is mainly for generalization/specialization in Smalltalk-style languages. There exist OO languages that don't have any notion of inheritance; extension is done by composition and interface "exporting".

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    12. Re:The "most controversial" proposal by bmetz · · Score: 2

      >In general, in computers, closure is a good thing. Ask any functional programmer. Ask any
      >language theorist. Closure is good. To simplify closure, I am referring to having rules that
      >don't have exceptions. Having a uniform representation for as much as possible.

      You clearly have never used perl :)

      --
      What did you eat today? http://www.atetoday.com/
    13. Re:The "most controversial" proposal by battjt · · Score: 2

      Primatives should be teatable like objects, so 5.add(7) is equivalent to 5+7. But I want to be able to 5.toString() or myHashMap.put(5, 9)! Let the compiler work it out. This is not new technology, Smalltalk has been doing it for 20 years.

      Joe

      --
      Joe Batt Solid Design
    14. Re:The "most controversial" proposal by jtdubs · · Score: 2

      I call the buzzwords because they predated and will eventually post-date the fad of OO programming and yet are always used in relation to OO. I full know well what they mean. I've been doing OO programming for almost 10 years.

      No, you can not write OO in assembler. To do so would require doing all of the bookkeeping by hand with regular variables. In which case you have implemented an OO framework on top of assembler. In which case you are actually programming in the meta-language you implemented on top of assembler.

      I realize i'm being pedantic here, but it's a matter of terminology. OO code is code that uses objects, whether or not those objects are themselves messes of spaghetti code. OO style is a method of writing objects that take advantage of the OO buzzword list.

      OO style can be written in any language, including assembler, C, Pascal, you name it.

      OO code however can only be written in an OO language.

      If you implement an OO framework on top of assembler then you are actually programming in your framework, which is an OO meta-language.

      Justin Dubs

    15. Re:The "most controversial" proposal by funkman · · Score: 2

      Anyone else find number 8 contradictory (Funny)?

      I simply want to make them full objects with classes, methods, inheritance, and so forth

      ... Stuff ...

      The classes would probably be final for reasons of both safety and performance.

      If they are final - isn't many of the advantages of making them an object now gone?

    16. Re:The "most controversial" proposal by swillden · · Score: 2

      I've been doing OO programming for almost 10 years.

      10 years? Yes, I believe it. Your inexperience shows. I might point out that this "fad" has been around for nearly three times your "age" as a programmer. It didn't become mainstream until about 10 years ago.

      No, you can not write OO in assembler. To do so would require doing all of the bookkeeping by hand with regular variables. In which case you have implemented an OO framework on top of assembler. In which case you are actually programming in the meta-language you implemented on top of assembler.

      You continue to confuse language with structure.

      I realize i'm being pedantic here, but it's a matter of terminology. OO code is code that uses objects, whether or not those objects are themselves messes of spaghetti code.

      That is your definition, but not one that many would share. Can you support this argument with references from literature?

      OO style can be written in any language, including assembler, C, Pascal, you name it.

      Absolutely. And using the "style", as you call it, provides 75% of the benefit. The syntactic sugar and bookkeeping provided by the language are of lesser value.

      OO code however can only be written in an OO language.

      Again, you are providing a *definition* here, of what *you* mean when *you* use the term.

      Hello, Humpty Dumpty.

      If you implement an OO framework on top of assembler then you are actually programming in your framework, which is an OO meta-language.

      Are you presuming some set of macros that implement this framework? That's convenient, and a good idea, but not strictly necessary. It is entirely possible to write objects in the style of C++ directly in assembler. Granted, if you wanted to implement some Smalltalk style of message-passing you'd have to construct a framework.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    17. Re:The "most controversial" proposal by CaptainAlbert · · Score: 2

      >OO style can be written in any language, including assembler, C, Pascal, you name it.

      > OO code however can only be written in an OO language.

      This is a distinction which I've never heard made before. I don't believe that it holds water.

      By the duck argument: If it looks like an OO program, and it quacks like an OO program, then it's an OO program. If it neither looks nor quacks object oriented, then it's not. The language is merely the vehicle for expression.

      Doing OOP in a language which doesn't support it is a nuisance, and writing non-OO code in a language which is "purely OO" can also be so. I spent some time writing OO code in ANSI C, then gave up because manually maintaining a "this" pointer is messy, error prone and a waste of my time when I can get a machine to do it for free. And don't even bother trying vtbls and runtime type identification without language support.

      And yes, I've been in the position of inheriting some non-OO code (K&R C, in fact) and having to munge it into an OO framework. Yes, you do end up with some objects whose methods are just spaghetti, but by abstracting those functions behind a suitable class interface (i.e. encapsulation), you get some modules which can be used in an object-oriented application. You can go ahead and instantiate many objects of those classes, and they all function independently. But I *still* would not go as far as to call it object-oriented code.

      Because it doesn't quack.

      --
      These sigs are more interesting tha
    18. Re:The "most controversial" proposal by jtdubs · · Score: 2

      Yes, OO has been around that long. Almost 30 years now. But as I'm only 21 that doesn't do me much good. :-).

      I am not confusing language and structure. If anything it is, again, a problem of terminology. Perhaps my definitions, as you point out, are not mainstream. They made perfect sense to me and seem to follow from the composition of the term "object-oriented" but it is possible that they are not mainstream.

      You are correct that the benefit comes from the style, not the language. The bookkeeping, however, is not of lesser value. It is necessary (more or less). It's just a question of whether you implement it yourself or whether the compiler and language do it for you.

      While OO is probably not a "fad" in the way you refer to it, in another sense it is. OO has become such a buzzword itself that many people get lost and assume that OO IS programming. That procedural programming is somehow antiquated and OO is the way of the future.

      I suppose that's possible. But if it's true then I'm ashamed to be a programmer. I've used over 30 languages in my short time as a programmer and am very familiar with the concepts involved. OO, atleast in almost all current implementations, in severely limited. Even more so in Java where it's a damned shame that they diluted the term OO by using Java as an example.

      Anyway, I see your point about my terminology and I apologize for the confusion. I hope you can see the point I was trying to make about the separation of built-in functionality and home-grown functionality, of language and style.

      The future, in my mind, is with a separation of data from algorithms. Data exist in the forms of classes with a mostly common interface. They provide no functionality, only server to wrap up data. Algorithms exist as generics (Generic Methods, called via Multiple Dispatch).

      This gives you all of the benefits of OO with none of the problems.

      OO is a valiant attempt to allow for polymorphism, but in my mind one that is doomed to fail. It will likely be replaced slowly and evolutionarily as programmers hate paradigm changes because they invalidate all that they have learned.

      Justin Dubs

    19. Re:The "most controversial" proposal by Inoshiro · · Score: 2

      "
      > hash tables. We could write methods that
      > operated on all variables and data.

      What you really need is generics (as in C++ templates).
      "

      No, he missed it. OO has a great feature called polymorphism. Granted, templates can work better (less code to write) for small situations, but for large, complex situations where different types do need to be handled differently, polymorphism is the answer he's looking for.

      Templates for powers will work great on all number types where the power operation is the same, but when you need to also have a member which takes strings and converts and powers and converts back and returns that, you'll want polymorphism.

      --
      --
      Internet Explorer (n): Another bug -- that is, a feature that can't be turned off -- in Windows.
    20. Re:The "most controversial" proposal by cartman · · Score: 2

      > I don't think getting rid of primitives is
      > realistic.

      It is very realistic; it has been done successfully in several languages.

      > What would you use to index
      > arrays with? Objects?

      You would index arrays with integers (objects).

      > So arrays would
      > inherently be hash maps? What kind of
      > performance impact would that have?

      No, an array would not be a hash map. A hash map allows dynamic insertions/deletions and stores by a hashing function, whereas an array is a continuous region of memory. Objects would present no performance impact, since the compiler could easily "convert" the object integer index into a primitive as necessary.

    21. Re:The "most controversial" proposal by Broccolist · · Score: 2
      If I was asked "what is the most harmful programming construct", I would choose type casts every time - yes, even over gotos and pointers.

      Sure, we've all seen programs where casts were horribly abused (in my case, from one of my CS profs :). But casting is a necessary feature: I'm sure that, as much as you hate it, every so often you've been forced to do a dynamic_cast, because it's the only reasonable solution. Casting should be discouraged, but I don't see how it can be removed from a language like C++ or Java. As for gotos and pointer arithmetic, they can be eliminated completely (and indeed, Java did so).

    22. Re:The "most controversial" proposal by cartman · · Score: 2

      > OO has a great feature called polymorphism.

      > Templates can work better (less code to write)
      > for small situations....

      Templates are _not_ meant as a substitute for polymorphism! The two are _not_ related!! I keep seeing this brought up. Templates are meant to resolve the current type unsafety of collections (and related) classes! This is a problem that _cannot_ be solved with polymorphism. Polymorphism and generics are not the same thing and do not exist for the same purpose!!

    23. Re:The "most controversial" proposal by p3d0 · · Score: 2
      How can you write a Non-OO program in a Pure-OO language? Cause, you see, it's not possible. You can write a program that isn't in the OO style that you think of when you think of OO. But you can't write a program that has data that isn't an "object" in a Pure-OO language.
      What does this mean exactly?

      If a program is not in the OO style; if it doesn't decompose a problem by data abstractions; if it doesn't solve problems using encapsulation and polymorphism; then just what exactly do you mean when you say that data is an "object"?

      (I don't mean that question rhetorically--if you have an answer, I'd like to hear it.)

      If you believe you can't write non-OO programs in an OO language, then I envy you the coworkers you must have had. :-)

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    24. Re:The "most controversial" proposal by p3d0 · · Score: 2
      If they are final - isn't many of the advantages of making them an object now gone?
      Nope. They still have classes and methods. They can still inherit (though user classes can't inherit them).

      There's a lot more to classes than what you quoted; yet even by those meagre criteria, final classes still qualify.

      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
    25. Re:The "most controversial" proposal by swillden · · Score: 2

      But as I'm only 21 that doesn't do me much good. :-).

      Ach! I knew you were green, but I didn't realize you were that green. I'll be nicer.

      You are correct that the benefit comes from the style, not the language. The bookkeeping, however, is not of lesser value. It is necessary (more or less).

      You're speaking to someone who has worked on large software applications (>300Kloc) written in C using an object-oriented style. The bookkeeping is not necessary, and actually not even as much help as you might think it is. It *is* useful, but it's not essential.

      There are a substantial number of experienced programmers in the world who like OO, but don't like any of the OO languages. Basically, they see C++ as too complex and ugly, Eiffel and Ada99 as too obscure and, hence, non-portable, and everything else as too slow (I'm not one of them, BTW, I like OO languages).

      While OO is probably not a "fad" in the way you refer to it, in another sense it is. OO has become such a buzzword itself that many people get lost and assume that OO IS programming.

      Agreed. I think you yourself have fallen partially into this faddish trap, in believing that the language used has relevance to the style used.

      That procedural programming is somehow antiquated and OO is the way of the future.

      First, nearly all OO programming is procedural. I think you meant to say "that traditional structured programming is somehow antiquated." For examples of non-procedural programming, look to functional and declarative languages, like FORTH and Prolog. For a "hip" example, check out XSLT, which is mostly declarative but with procedural bits.

      If you're not familiar with the different types of languages, I highly recommend that you take some CS courses covering them. A little experience with non-mainstream languages like Scheme, SNOBOL, ML, CECIL, etc. can really crystallize your understanding of the different styles and idioms and the tools that support them. You mentioned multiple dispatch in your post, though, so you may have seen some of them.

      However, I think that you're going to find that OO is not a fad that is going to go away. OO is better for most general-purpose computing than structured. The binding of data to algorithm has arisen as the dominant model of software development after twenty years of solid industry experience with the other model. Why did people change? Because they're stupid? Not at all. Young engineers tend to get caught up in the hype but by and large older engineers don't change unless there are good reasons (and sometimes not even then!).

      That said, I think I mostly agree with you about where things are heading, except that your terminology is a bit off. Smarter data, with general-purpose, abstract interfaces (ala XML) is going to be important. I don't know if multiple dispatch will really be all that important; it's nifty but a little too clever for widespread use -- although multiple dispatch leads to some very clean, elegant designs it can create some very hard-to-track bugs.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    26. Re:The "most controversial" proposal by jtdubs · · Score: 2

      Haha. No need to play it nice. :-)

      I think OO is a fabulous concept, but I am more in favor of higher level languages. I think LISP's CLOS has the best object model I've used. Classes with slots. Accessors. Generics w/ multiple dispatch.

      I find C++ limiting due to its lack lf runtime type checking, which disallows some of the more elegant solutions to problems and gives rise to the need for such hacks as the Visitor "pattern."

      As Paul Graham, the LISP guru, so elegantly put it (this is NOT verbatim):

      "I don't like patterns. When I see patterns in my code it means I'm not working at a high enough level of abstraction."

      I disagree that I've fallen into this "faddish trap." I've used C, C++, Assembler, Prolog, Scheme, LISP, Ada, SML/NJ, OCaml, Fortran, Cobol, Pascal, BASIC, Java, Perl, Python, Ruby, Eiffel, Erlang, Forth and far more languages that I can't pull off the top of my head.

      Language has nothing to do with style. Some languages just take care of more of the work for you and abstract you more from the underlying machine.

      You CAN write "OO-style" code, meaning code that exhibits features such as polymorphism, data-hiding, encapsulation and such in absolutely any language. You can do XP style programming in any language.

      But you can't do OO unless you have Objects, which you can't do unless you have a language that has objects, unless you make them yourself, in which case you've changed the "core" language.

      Then again, this is probably just semantics. I can't find the right way to express this belief.

      I am more than familiar with the different styles of programming. From structured programming to OO, from procedural to functional to concurrent, from static scoping to dynamic scoping, from compile-time to run-time binding, from eager to lazy evaluation. I may be green, but I am a fast learner.

      I think I actually agree with everything you say, and I think you'd agree with most of what I say, surprisingly. It's just my lack of communication skills today that may be letting us down.

      Regardless, thanks for the feedback.

      Justin Dubs

    27. Re:The "most controversial" proposal by Anonymous+Brave+Guy · · Score: 2
      I must be dense, but I don't have a clue how C++ templates are related to generic methods, or to multi-dispatch. C++ templates are truly hideous, but the ideas inherited by most "generics" implementions in Java compilers I've looked at haven't looked too bad.

      Erm... OK, I'll certainly agree that C++'s templates have a nasty, kludgy syntax. But surely the basic idea of having parameterised functions and types is about as basic in the generic programming spectrum as you can get? Whether the parameters are specified implicitly or explicitly, the underlying model is much the same. And the bits that Java borrows in its new spec are a sadly restricted subset of the same model. I don't see how you can object to C++ templates and advocate Java generics in the same sentence...

      But yes, I think we've both been trolled; I was thinking the exact same thing about closures as I read the parent post. :o)

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    28. Re:The "most controversial" proposal by Anonymous+Brave+Guy · · Score: 2
      I've used C, C++, Assembler, Prolog, Scheme, LISP, Ada, SML/NJ, OCaml, Fortran, Cobol, Pascal, BASIC, Java, Perl, Python, Ruby, Eiffel, Erlang, Forth and far more languages that I can't pull off the top of my head.

      Fair enough. I guess the question is really how deeply you've used them. I'm not much older than you, and I too am enthusiastic and a fast learner, yet in spite of my formal background in CS and a few years working as a professional developer, I'd only really claim to know half a dozen languages in any depth. I may have experienced the basics of SML/NJ, OCaml, Perl, Python, LOGO, Scheme, FORTRAN, Java, BASIC in several forms, C, C++, Eiffel, x86 assembler, HTML, CSS, XThings, (La)TeX, METAFONT, MS batch files, JavaScript, and probably a few more if I think for another minute, but I don't truly understand more than a few of them.

      With no insult intended, I would submit that while your experience is broad, it probably is not yet deep (e.g., your comment about RTTI in C++ seems to be incorrect). That, and a general lack of exposure to the industry and the different spins people put on things depending on their background, would probably account for much of this thread.

      BTW, I always liked the terms "object-based" for a programming style where you have types that combine state and behaviour, and "object-oriented" for a programming style that makes use of polymorphism, encapsulation, etc. I don't believe there is any such thing as an OO language; there are just languages that support either or both of the above styles.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    29. Re:The "most controversial" proposal by Ayende+Rahien · · Score: 2

      > Lord God NO! Don't you EVER use C++ templates as an example of generics again. C++ templates are an attrocity. What you want is generic methods with multiple-dispatch. Look at Lisp's CLOS, or Dylan.

      How about Ada's Dynamic Dispatch method?

      > How can you write a Non-OO program in a Pure-OO language?

      Pretty easily, there are some FORTRAN programs out there written in LISP, you know.

      --

      --
      Two witches watched two watches.
      Which witch watched which watch?
    30. Re:The "most controversial" proposal by Ayende+Rahien · · Score: 2

      class Blat
      {
      static int a;
      static float b;

      public static void main(int argc, string[] argv)
      {
      a = 5;
      b = a * 2.5;
      foo();
      bar();
      return a;
      }

      private static void foo()
      {
      }

      private static void bar()
      {
      }

      }

      Are you willing to be on it? Here is a program that might as well be taken from plain C code.
      It's got global variables, too, just for spite.

      --

      --
      Two witches watched two watches.
      Which witch watched which watch?
    31. Re:The "most controversial" proposal by jtdubs · · Score: 2

      Fair enough.

      Like you, I only know around a dozen of the 30 languages I've used in any depth. Some of those dozen are functional, others procedural.

      My comments about RTTI in C++ are NOT wrong, however. C++ does not have run-time type checking of arguments to functions. It has inheritance, and with it virtual functions. This means that if you have a class and a subclass, and instances of each, that even if you cast the subclass to be a pointer to the superclass, if you try and call one of it's methods it will still call the one of the subclass, assuming it's virtual.

      In other words:

      class Super {
      public:
      void foo() { printf("Super::foo()"); }
      };

      class Sub : public Super {
      public:
      void foo() { printf("Sub::foo()"); }
      };

      int main(int argc, char** argv) {
      Super* s1 = new Super();
      Super* s2 = new Sub();
      s1->foo();
      s2->foo();
      delete s1;
      delete s2;
      }

      This code will produce the following:
      Super::foo()
      Sub::foo()

      So, theres polymorphism. Now, what about RTTI of arguments to functions. Known as multiple-dispatch. Unfortunately, C++ only implements single-dispatch, which means choosing the appropriate method based on the type of the object via which the method is being called. So:

      class Super {
      public:
      void foo() { printf("Super::foo()"); }
      };

      class Sub : public Super {
      public:
      void foo() { printf("Sub::foo()"); }
      };

      void Receiver(Super *super) {
      printf("Receiver(Super)");
      super->foo();
      }

      void Receiver(Sub *sub) {
      printf("Receiver(Sub)");
      sub->foo();
      }

      int main(int argc, char **argv) {
      Super *s1 = new Super();
      Super *s2 = new Sub();
      Receiver(s1);
      Receiver(s2);
      delete s1;
      delete s2;
      }

      This will produce the following output:

      Receiver(Super)
      Super::foo()
      Receiver(Super)
      Sub::foo()

      See the problem? That's due to C++ single-dispatch nature.

      Justin Dubs

    32. Re:The "most controversial" proposal by Anonymous+Brave+Guy · · Score: 2

      I think we have the same problem again. :-)

      To me, what you are describing is more than RTTI, it is multiple dynamic dispatch (which, it is certainly true, is missing from C++). RTTI, OTOH, is simply things like typeid or dynamic_cast, which allow you to determine, at run-time, the type of object that you've been passed. These could actually be used to implement a solution to your multiple dispatch problem under some circumstances, though it's certainly not as tidy as it would be in a language with native support for the feature.

      #include <iostream>
      using namespace std;

      class Base
      {
      public:
      virtual void Speak() { cout << "Base speaks" << endl; }
      };

      class Derived : public Base
      {
      public:
      virtual void Speak() { cout << "Derived speaks" << endl; }
      };

      void Speak(Base* pb)
      {
      if (Derived* pd = dynamic_cast<Derived*>(pb)) {
      cout << "A Derived object will now speak:" << endl;
      pd->Speak();
      } else {
      cout << "A Base object will now speak:" << endl;
      pb->Speak();
      }
      }

      int main()
      {
      Base b;
      Derived d;
      Speak(&b);
      Speak(&d);
      return 0;
      }

      (Darn, I hate /.'s limited formatting sometimes...)

      To me, this example is all that is implied by RTTI, and it's obviously possible in C++. As ever with the language, if you want to build more power on top of it, the tools are there but the extra power isn't provided as standard.

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    33. Re:The "most controversial" proposal by jtdubs · · Score: 2

      Ah, right, I see what you mean.

      I am unaware of the formal definition of RTTI, so you may very well be correct.

      If by RTTI you mean the ability to manually determine the type of a pointer via typeid and the ability to do dynamic_cast then, yes, obviously C++ would support RTTI.

      What I was referring to would be more accurately described by two terms. First off, dynamic vs static typing. C++ is obviously static. There aren't that many problems with this, but there are many useful things that can only be easily done with dynamic typing. Secondly, as my example demonstrated, single vs multiple dispatch. Where C++ chose single and CLOS uses multiple-dynamic.

      Anyway, yeah, this is probably another terminology thing. Being completely self taught there are a fair number of industry standard terms whos concepts I am familiar with but names I am not. This is one of those cases.

      Thanks for clearing that one up,

      Justin Dubs

  12. The Mac OS X JVM has this already by d3xt3r · · Score: 5, Insightful

    it also means each process has the initial overhead of starting the VM and the continuing overhead of the same duplicated code running in memory for each VM.

    Startup time is not only an actual problem, but its gives a very bad impression when just launching a program takes a while.

    Apple's JVM implementation for OS X already supports some of the features which you are requesting... For instance, Apple's JVM uses a shared memory space between JVM instances. This significantly reduces the memory footprint of each JVM instance and allows classes to be loaded only once. Example: I launch 2 Swing apps, they can share the same JFC classes, requiring class loading only once. I can stop and start the one of the appilcations without having to wait for Swing to be reloaded into memory.

    Additionally, startup time is really not an issue on OS X. I am writing a fairly complex Java Swing application right now. On start up, it parses 3 (one of which is very large) configuration files, it creates a few Swing components, and finally displays a complex JFrame to the user. Total time for a cold start (no other JVM loaded) is approximately 2 seconds. That's certainly not slow. Not Sun needs to take a look at what Apple did and implement it back across their JVM implementations.

    One big thing Java needs is a multi-process VM.

    I don't really see what the advantage of this is. Again, the JVMs from Sun and Apple both use native threads. On most platforms, thread creation is less expensive than process creating. This is why Apache 2.0 is a hybird muli-threaded/multi-process application. Apache used to run a multi-process only model and it bogged down on Solaris b/c of process creation overhead. The new model overcomes this by using threads more heavily. As long as the threads take advantage of native thread features, like _____, thread use is most likely more efficient than process use.

    BTW, on Linux, there is no real difference between a process and a thread, so Sun's JVM is already "multi-process" on Linux. And it's not any faster than their other implementations. As a matter of fact, Apple's JVM blows away Suns implementation on Linux and Windows (I haven't been able to test against Solaris).

    1. Re:The Mac OS X JVM has this already by Mr.+Quick · · Score: 2

      d3xt3r,

      where did you get this info? i'm not second-guessing you, i just want to read it. can you point me to these docs, or is this something that you've learned through development.

      thanks,
      tyler

    2. Re:The Mac OS X JVM has this already by d3xt3r · · Score: 2
      Well, you can start with Apple's Java page. You'll have to poke around a bit, but they have info on their JVM implementation there.

      I also have read about their JVM implementation at O'Reilly's web site (sorry, don't have any links but I'll see if I can find you some).

    3. Re:The Mac OS X JVM has this already by Mr.+Quick · · Score: 2

      perfect, that's great.

      i assumed that apple's dev site was the main jumping off point, i obviously just haven't looked around enough.

      thanks.

    4. Re:The Mac OS X JVM has this already by CynicTheHedgehog · · Score: 2

      It's been my experience that Swing applications run immeasurably faster using the Windows JVM. SunONE Studio CE and LimeWire respond quickly, don't flicker, and in general behave like native applications. The same cannot be said with Linux, sadly. Poking around on my iBook I noticed a whole lot of JNI stuff in the Java library paths...looks like a bunch of hooks into the user interface and operating system. I'll have to explore that more, but it looks pretty exciting.

      But back on topic, breaking Java1 and Java2 compatibility is absolutely asinine. That would contradict one of the core design principles. Apple's got a decent JVM, apparently; the Windows one ain't bad; and IBM's developing a clustering VM that yields an 80% performance boost (or some ridiculous number like that).

      The big thing I'm noticing is that Sun's implementation is somewhat lacking. What we need is a faster, more efficient VM. We have the specs, so that shouldn't be a problem. Or at least Apple and IBM don't seem to think so.

    5. Re:The Mac OS X JVM has this already by d3xt3r · · Score: 2

      I rememebered the other place I saw some great info on Apple's Java implementation was Java Developer's Journal March 2002 issue. They have a 10 page spread discussing Java on OS X.

    6. Re:The Mac OS X JVM has this already by maraist · · Score: 4, Informative

      BTW, on Linux, there is no real difference between a process and a thread, so Sun's JVM is already "multi-process" on Linux.

      You confuse me, because you obviously must understand the difference between threaded and multi-processed, yet you claim that there's no difference in Linux. There are numerous functional differences between the two. First and foremost, you have 100% isolation (sand-boxing). You're not concerned with race-conditions (well, you have to go out of your way to produce them at least), you have to explicitly share material (e.g. pipes or magical fork-aware objects), you're crash-proof (apache has a master process image; if one worker "thread" dies for almost any reason (baring OS problems), it VERY quickly forks a new worker which is 100% ready to go), and finally, MP has better caching issues with multiple CPUs (e.g. no shared and slow writable cache). To boot, while MT saves more total memory, MP more efficiently distributes it to workers. Non modified memory is freely shared in a safe manner (marked as read-only by the OS, and thereby efficiently cached by each CPU), and only modified memory gets moved. Granted, in JVM's garbage collector, the entire heap is constantly remodified.

      As other's have said, I support the general idea of Apple method of sharing memory space between JVM's; though I don't know it's particulars. Most notably, the shared memory should be read-only (to avoid interdependency crashes). Next, it should only be shared per user (or at least copy-on-write), to disallow viral infections.

      My concern is obviously for that of robustness. Java is already flimsy as it is in this respect (imagine running an entire OS with a single such point of failure).

      --
      -Michael
    7. Re:The Mac OS X JVM has this already by d3xt3r · · Score: 2

      Most kernels differentiate between processes and treads, however, the Linux kernel does not. In most OSes process context switches are slow, while thread context switches are fast. However, in Linux, process switches are fast. In Linux a process simply represents a schedulable entity. The scheduler does not care about the process or thread's shared resources. A linux processes has full control over its resources and child processes.

    8. Re:The Mac OS X JVM has this already by egomaniac · · Score: 5, Insightful

      My concern is obviously for that of robustness. Java is already flimsy as it is in this respect (imagine running an entire OS with a single such point of failure).

      "Flimsy"? I've been a professional Java developer for six years. I have written server software (running to Solaris and Linux) and client software (Swing applications running on Windows, Macintosh, and Linux). The server-side software is used by almost a million people a day; the client-side software hasn't yet been released to the public but is already being used internally. It will be used by millions when it is released.

      Number of Java crashes I have seen in the past few years: Zero.

      Java is obviously only as stable as your computer, so of course when a whole Windows machine goes down, you lose Java as well. However, I have seen absolutely no crashes directly tied to Java, on any OS, since JDK 1.2.2 came out. I don't know what version of Java you are playing with, but I'd hardly call that "flimsy".

      As far as "imagine running an entire OS with a single such point of failure", that is perhaps the most ridiculous thing I've ever heard. Are you suggesting the Linux kernel is not a single point of failure? When the Linux kernel freaks out, your whole system goes down. That's a single point of failure if I've ever heard one.

      --
      ZFS: because love is never having to say fsck
    9. Re:The Mac OS X JVM has this already by maraist · · Score: 2

      "Flimsy"? I've been a professional Java developer for six years. I have written server software (running to Solaris and Linux) and client software (Swing applications running on Windows, Macintosh, and Linux)....

      Number of Java crashes I have seen in the past few years: Zero.

      Swing was horrendously buggy initially. In fact, we found many a case where the old java 1.1 cored on solaris (with and without swing; though swing had a much greater propensity to crash or hang). None of the companies I've worked with has dared use swing in production code, so I don't know how good it is these days.

      As for robustness, I'd like to point out that core dumping isn't the only metric. Java uses more memory than any other language I've seen used at the enterprise level. (I'm sure there are worse, but I've not enountered them). Using any sort of swap with java is insane, because of it's garbage collection model (In my opinion, a mixed blessing at best). I've actually written several garbage collectors and memory managers, and my opionion is that any such mark/sweet or collector is not suitable for arbitrarily large enterprise apps. Once you can get your app into a state where it's out of main memory, you're thrashing to the hard drive on every gc. Heaven forbid your app actually requires more memory than you have physical by itself. It's bad enough when you have two competing java apps fighting for memory.

      Personally, I prefer ref-counting, which adds run-time performance overhead, but avoids the swap-thrashing issue for heavy-loads. I know that java is capable of utilizing any garbage collection scheme it chooses, but the defaults are never ref-counting; even on such hungry apps.

      The main reason I dislike non-ref-counted garbage collection is that a simple loop which allocates and throws away strings produces hundreds of thousands of memory allocations under many systems (such as in many jdbc drivers). These simple small and allocations would be trivial to maintain under ref-counting.

      Sorry for ranting, but I just so happen to be plagued with these issues (a servlet engine idling at 298Meg even with different VM's and settings).

      Further on the stability issue. Not allowing static linking, and allowing new versions of classes to sneak in and thereby cause crashes is a common occurance with that java-model.

      Java is obviously only as stable as your computer,

      So is visual basic, but I think make such a statement about VB is misleading, since even syntax errors can lay dormant in VB waiting for just the right section of code to be accessed; crashing your app. I definately believe java to be a robust "syntactic language", but the underlying platform is still very sensative to design and maintanance mishaps.

      There is a large amount of indeterminism associated with Java.. When will it garbage collect, when will file handles be closed, how much memory is it going to need, etc. These things make it harder to design robust enterprise systems (though not impossible). These are the sorts of gotcha's that reduce Java' stability in my opinion. Yes you can design bad c-code, but it's almost impossible to attain determinism with java in some areas.

      As far as "imagine running an entire OS with a single such point of failure", that is perhaps the most ridiculous thing I've ever heard. Are you suggesting the Linux kernel is not a single point of failure?

      There is a javaOS, by the way. A hardware product an old company of mine created used it. And I'm not suggesting that linux isn't a single point of failure.. I AM suggesting that the platform the linux kernel was developed on is more inherently stable than java. The key word was "such", which meant my so called "flimsy" java being the weakest link and also being a single point of failure for everything. Thus the most stable you can get a javaOS pales in comparison to the most you can get with c. Granted, an initial build of a javaOS is probably going to be more stable than that of c due to java's inherent type-safety.

      Java is getting better; yes. And VM writers are free to develop better memory managers. But it's still bleeding edge in my opinion. I wouldn't consider java as having 4 nines availability; especially if the latest features in each release are being utilized. What's worse, the fact that most old features keep getting deprecated, it's nearly impossible to maintain a properly robust API (e.g. to say, yes, java.io is finally robust since it's had 2 major versions behind it).

      --
      -Michael
  13. Isn't by yatest5 · · Score: 2, Interesting

    making improvements to Java, which make it incompatable with older JVM's, and simplifying and improving the GUI bit, exactly what MS did and got slated for?

    --
    • Mod parent up! [a] by Anonymous Coward (Score:5) Thurs, June 31, @13:37
    1. Re:Isn't by tswinzig · · Score: 2

      The difference being we can definitely expect Java 3 to make it to platforms besides Windows.

      --

      "And like that ... he's gone."
    2. Re:Isn't by yatest5 · · Score: 2

      The difference being we can definitely expect Java 3 to make it to platforms besides Windows.


      I think the difference is we're not going to see a Java 3, or certainly not one that implements the changes set out in this document.

      --
      • Mod parent up! [a] by Anonymous Coward (Score:5) Thurs, June 31, @13:37
  14. What a great article. by Shayde · · Score: 2, Insightful

    Its wonderful seeing well thought out postings on this topic - my respect for this guy has just gone up a LOT, and I'm going to take a look at his books.

    Talking about "what should be Java" and "what should not be Java" is a volatile topic no matter how you slice it. One thing I think the Java community has going for it is that they're not nearly as fragmented or hyper-screaming knee-jerk as a lot of the C or C++ community is.

    I could see Sun and/or the JCP taking these proposals and starting the J3 development cycle. The trick is that much of what he's talking about is more than just a couple weeks hacking by a few dozen coders. Theres some serious internal redesigns here. However, he has worked them all through, with well-thought out arguments for and against each of his points.

    I don't profess to be a Java guru. I've only been working in the language for about a year, but I've found it strong, the community intelligent and professional, and the environment a pleasure to work with.

    Java ain't just applets and painfully slow JVM's anymore.

    --
    Event Management Solutions : http://www.stonekeep.com/
  15. Not much left... by Anonymous+Brave+Guy · · Score: 2

    I confess that I'm confused. You use words like "supremacy" when praising Java over C++, yet you think it's missing three of the big strengths of C++ that you would find useful. It also has no generic programming support to speak of, yet this is one of C++'s strongest features.

    That's covered what Java takes out of C++, though of course you're not obliged to use any of it in C++ either. Java then gives you some degree of portability, GC and a vast standard library, though each of these also obviously has bad points as well as good (write once, debug everywhere/lack of deterministic destruction/bloat and bad design in places).

    I can't really think of any other "big features" that distinguish programming one from programming the other in a really significant way. That being the case, I can't understand how you could describe either language as being better than the other; surely if you're after portability and safety for junior guys you'd err towards Java, while if you're after performance, low-level hacking or more powerful design tools you'd err towards C++?

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  16. Re:Arse by Jugalator · · Score: 3, Funny

    Well, tell them to get fucked and go and read the Java tutorial then!

    Hey, it's hard to figure out the classpath! You need to take the dots and change them into slashes, for crying out loud! And never forget the classpath is relative to the base directory! my head hurts... *sob*

    --
    Beware: In C++, your friends can see your privates!
  17. Point by point by joe_fish · · Score: 4, Insightful

    10. Delete all deprecated methods, fields, classes, and interfaces

    They don't get in my way much, so removing them wouldnt help me at all. It would only force me to re-write old but working code. I disagree with this one.

    9. Fix incorrect naming conventions

    Is InetAddress really that confusing that I need to re-write everything? And where is the benefit to me in moving java.sql to javax.sql. None that I can see, and it will create more errors until I learn the new way. I disagree with this one too.

    8. Eliminate primitive data types

    I can see the benefit to this. I like C#'s compromise where it automatically casts from native type to Object. BUT I don't think it is a good idea to slow Java down. It already has a bad reputation for speed, lets not make things worse. And as for "The int/char/double/float/boolean objects would be immutable, so these objects would be thread-safe and could be interned to save memory" I don't think you've really though this through Eliotte. What about "i++"? So I disagree with this one too.

    7. Extend chars to four bytes

    May I dont spend enough time writing XML parsers, but I've never been bitten by this one. So to me it doesn't seem worth the cost of re-writing everything. So I disagree with this one too.

    6. Fix threads

    Yes Thread have had problems, but they are still very useful. I'm prepared to make use of Thread and wait for the JSR to come up with improvements. I am more in agreement here, but not to the point of shoulding applause

    5. Convert file formats to XML

    I can see the benefits, but not enough to re-write all my servlets etc. And I don't think this change requires Java 3, just some updates to the servlet spec etc. Reason for Java 3? Not from where I stand.

    4. Ditch the AWT

    I can hear people (IBM) wanting to drop Swing because it is too slow, but not so much wanting to drop AWT. The key thing is where does anyone benefit from removing AWT? Surely have a class call JButton is not that complex that we need to break all that code? I'm not agreeing with this one much either.

    3. Rationalize the collections

    Well there aren't that many problems. I suggest we just *gradually* deprecate Vector and Hashtable and carry on with the alternatives.

    2. Redesign I/O

    No not again! Please! I've taken 2 re-writes already. Perhaps File could be updated as some of Eliotte's suggestions, but that hardly requires Java3.

    1. Redesign class loading from scratch, this time with human interface factors in mind

    Accepted this is a problem. But while neither I nor Eliotte has a solution, perhaps we should make do with learning the idiosyncracies, or finding solutions rather than calling for Java 3.

    1. Re:Point by point by Fweeky · · Score: 2
      What's wrong with i++? It's just shorthand for "i=i+1"


      No, i++ is shorthand for "i.increment()". If you make ints etc immutable you can't do this, because it's like trying to write 1++, hence making all instances of 1 in the system into 2.

      It's no great loss imo; I thought I'd miss it in Ruby, but it turns out that i+=1 isn't much more to type and there's a lot to be said for having a nice clean object model.

      Of course from a backward compatibility standpoint it would suck somewhat. It'd have to be called Java++ or something ;)
    2. Re:Point by point by jiriki · · Score: 2, Insightful

      [Classloading]
      > Accepted this is a problem.
      Classloaders are a little difficult to understand, but they are not a problem!

      Classes loaded by different classloaders may never have the same type, because they might be completly different, implement different interfaces and have nothing at all to do with each other.

      Also you could load a class java.lang.String from a different Classloader and pass it to other classes. The class is declared final, but who cares, if you can just load a different class in a different classlaoder? This would cause huge security problems.

      Classloaders are implemented the right way. So don't change this (The exception messages could be improved though).

    3. Re:Point by point by lscoughlin · · Score: 3, Insightful

      Wow.

      Ok, all of your disagreements amounted to: "It doesn't affect me so i don't know but it shouldn't change anway", "I'm too lazy to learn a new way.", and "I can't think of a better way so there must no be one."

      About the most useless and long commentary i've seen in a while.

      Of course this response entire can be summed up as "You're dumb" and thus isn't real useful, but yeesh.

      --
      Old truckers never die, they just get a new peterbilt
    4. Re:Point by point by maraist · · Score: 2

      In the Summary part, there were these additional comments:


      eliminating checked exceptions (as Bruce Eckel has advocated),

      Don't know enough to understand what this means. Is he wanting to get rid of catch clauses?

      limiting objects to a single thread as in Eiffel

      My initial impression is that this is very good. I know that I was really worried when I first found that java only has single inheritance, but I've usually found work-arounds, and this definately seems a clean design.. Thus it shouldn't be too much of a stretch to accept this thread-isolation. I don't fully understand how it would work (do cross object method invocations require a transfer of run-time control? That seems terribly inefficient).

      I know that perl5.8 / 6 is using a novel method of thread control. The app is multi-threaded, BUT, each thread runs a fully independent VM. Variables must be explicitly shared. It just seems very clean.

      --
      -Michael
    5. Re:Point by point by Keith+Russell · · Score: 4, Informative
      eliminating checked exceptions (as Bruce Eckel has advocated),
      Don't know enough to understand what this means. Is he wanting to get rid of catch clauses?

      Exceptions come in two flavors, and the difference is simple. Checked exceptions must be caught, Unchecked exceptions don't. If you call a method that throws a checked exception, you must catch that exception, or the compiler flags it as an error. If the exception is unchecked, you can call the method outside a try-catch block without complaint from the compiler.

      Interesting that Java has checked exceptions, .NET doesn't, and developers from both camps want things the other way around.

      --
      This sig intentionally left blank.
    6. Re:Point by point by jwpalmer · · Score: 2, Informative
      Classloaders are implemented the right way. So don't change this (The exception messages could be improved though).

      Ack. The classloader architecture is one of the most poorly designed and inconsistently implemented parts of Java. The problem is that almost no one has to delve that deep into the doo-doo to get things done.

      However, if you're unlucky enough to be building an enterprise server architecture that requires separate classloaders (to avoid the JAR-version-hell of the classpath) get ready for fun:

      1. Half of the APIs in Java don't correctly use classloaders when they should. For example, when initializing the security API, you can't pass in a classloader - Java assumes that you will be using the standard classpath. WRONG!
      2. Statics allocated in classes are NOT garbage collected when the classloader is destroyed. So, if you use a classloader to manage your resources and allow a graceful stop and restart, all of your strings, objects, what have you will never get GCd. UNBELIEVABLY WRONG!
      3. The list goes on and on...

      As I said, the only reason that people believe the classloader API isn't broken is that they probably haven't had to use it. It needs serious help, above and beyond the ridiculously pervasive classpath issues.

    7. Re:Point by point by joe_fish · · Score: 2
      Nope. Wrong

      Not wanting to start again and re-write everything from scratch is not lazyness. It is common sense.

      Working Now has always and will always be better than Perfect Tomorrow.

    8. Re:Point by point by RovingSlug · · Score: 3, Interesting
      Ok, all of your disagreements amounted to: "It doesn't affect me so i don't know but it shouldn't change anway", "I'm too lazy to learn a new way.", and "I can't think of a better way so there must no be one."

      I'd say his commentary ammounted to "The ratio of benefit to breakage seems far less than one." And, I agree with him. Most of the proposed changes are nitpicking -- which is to say the final distance between the originial language and the "overhauled" language is not very far, and for all that effort, you bought incompatability.

      Give me templates and typedefs. Those are changes worth breaking the language over. Those are suggestions that can hold their weight in a "Top 10 Java 3" list.

    9. Re:Point by point by Oink.NET · · Score: 2

      This kind of "you'd better not break my existing code" whining is exactly what the Visual Basic folks did when Microsoft revamped their precious language into VB.NET. What did the rest of the world say to them? "Get over it." These language Luddites should get a copy of "Who Moved My Cheese" and read it.

    10. Re:Point by point by Fweeky · · Score: 2
      The String class is immutable and yet you can still say String a = "Hello"; a = a + " world"
      Yes, this is creating a new String object and assigning a to it. It's nothing like changing the string object itself.

      a is not the object, a just happens to point at the object.
      When you perform operations such as the autoincrement operator on immutable objects, it doesn't frickin change the object, it creates a new object and reassigns the variable to that new one.
      How do you do this while making ++ a method on the Numeric object? How do you give it the power to change what a variable name points to? Typically you'd return the next object, but without an assignment there's no place for the return value to go.

      You *could* make it magic and mean foo += 1, or make it take the return value and assign it to the lvalue, but it doesn't mean it's a good idea. It's certainly not going to make the language any cleaner or easier to write or understand.
    11. Re:Point by point by curunir · · Score: 2

      I don't think anyone is suggesting that we completely do away with Java 2. Heck, how many different 'current' versions of the Linux kernel exist? There's plenty of businesses that still use the 2.2 kernel because that's what they've tested against and trust for their environment. At the same time, those businesses aren't holding back development on the 2.5 kernel, so I get all the cool stuff that they wouldn't have been able to add to the 2.2 kernel.

      Something similar could be done here. I'm sure Java 2 could continue to be extended to fit the needs of people with who need backwards compatability. But why should those of us who don't need backwards compatability be held back because you wrote your code for a platform that was still in the early stages of its evolution?

      If there are fundamental problems with the language (and I think most people would agree there are), those problems need to be addressed. And if backwards compatability is the price of addressing those problems, so be it. Sun has made a commitment to support businesses who have developed for Java 2. That commitment wouldn't go away with the advent of Java 3.

      Maybe you should look at it from someone else's point of view instead of just thinking "how much code would I have to re-write?" I have huge amounts of code written for Java 2. Am I going to re-write it? Hell No! But would I want to have the opportunity to develop new projects in a Java 3 environment? Abso-Freakin'-Lutely!

      You can go through point-by-point and poke holes in his suggestions, but are you actually suggesting that Java 2 doesn't have some pretty serious problems that would be easier to fix if it wasn't limited by being backwards compatable? Didn't think so.

      --
      "Don't blame me, I voted for Kodos!"
    12. Re:Point by point by MillionthMonkey · · Score: 2

      10. Deleting all deprecated methods- what is the point of removing them? So the JVM libraries load a few milliseconds faster? Yet in the same article he suggests replacing primitives with objects, and pulls out Moore's Law as a rationale. The change is pointless.

      9. Changing InetAddress to "InternetAddress", and changing "java.sql" to "javax.sql"- this just creates busywork. Why don't we just go through the English language and change the spelling of all the words so they're more consistent with how they're pronounced? That would make even more sense and make English easier to learn. If you disagree it's because you're lazy.

      8. Eliminate primitive data types- This is a bad idea, and the article admits it- with the two words: Moore's Law. When you hear someone advocating some feature and they start talking about Moore's Law, you know right away it's a stupid idea. Each Object in Java incurs a 16-byte overhead from the JVM implementation. So a byte would use 17 bytes. And immutability for thread safety? Yeah, what about "i++"? How does equals() work? How does == work? Newbies already have this problem with strings (e.g. when they write if (option=="Y"). Now they'll have it with ints, floats, etc. And immutability for thread safety- oh man! The reason java.lang.Integer, java.lang.Boolean, etc. are so useless is that they're immutable. All they're good for is when you need to pass a primitive to a method that only takes Objects. A more rational way to deal with this is to introduce templates into the language. This is a big fix to a non-problem, designed to make OO aestheticians happy in their ivory towers. For anyone writing real code, this would be a disaster.

      7. Extend chars to four bytes- breaking just about every program out there- so we can cram Linear B into the charset? \u00000046\u00000075\u00000063\u0000006B that!

      6. Fix threads- see # 10. Yes, as far as I can see there are some good points here, but none justifying an upgrade breaking compatibility. As far as an object having multiple locks for different operations- this is easily doable without mangling the language syntax. Just add "getXSyncObject()", "getYSyncObject()", etc. to your object and have it return different lock objects for operations X and Y, and then synchronize on the objects returned by those methods.

      5. Convert file formats to XML- "I want XML and I want Sun to do it for me!" I can guarantee you that any XML format dreamed up by Sun/JCP committees will be about as detailed, useless, and version-fragile as the default binary serialization we have now. Write your own serialization mechanisms that return XML you write yourself. Stop being lazy.

      4. Ditch the AWT- Do this and I will HUNT YOU DOWN AND STRANGLE YOU. We never use Swing at our company because a "Hello World" in it loads 20 megs of classes. Everything uses AWT and our programs can actually run for more than an hour without crashing. (Although Sun has not been maintaining the AWT at all since Swing came out.)

      3. Rationalize the collections- What's the point of doing this? They seem rational enough to me. More busywork. See #9.

      2. Redesign I/O- This has been done already in 1.4.

      1. Class loading- Actually, once you realize that a classloader defines its own namespace, this can become a useful feature. I don't see why it should be removed simply because some people don't understand it.

      About the most useless and long commentary i've seen in a while.

      His post was articulate and brought up a good rebuttal to each of the points in this article. It deserved its 5 much more than yours did.

    13. Re:Point by point by Fweeky · · Score: 2
      No. Not unless you're going to hack it about to make it so.

      String s = "hello";
      s += " world";


      This produces three objects - "hello", " world", and the "hello world" produced by concatinating them. There's no in-place changes going on here.

      "hello world" <- "hello".+(" world")

      i++ is more equivilent to:

      "hello" << " world";

      Where the string "hello" is asked to concatinate " world" onto itself; changing "hello" directly. Of course, with immutable strings, you can't do that, unless you're willing to magically turn it into an assignment too.

      If you're going to make your int an immutable object, then call 1.++(), 1 has to deal with it itself. How exactly do you make 1 know who's referencing it? Why on earth would you even concider letting it?

      About the only way I can think of is a transparent proxy object that will track the return values of these methods, so all the variables pointing to it actually only see the proxy containing an object that changes.

      Sure, you *could* just hack it so when the compiler see's i++ it writes i += 1, or i = i.next, but that doesn't mean it's the same thing, and you'll really notice that when you start referencing objects from multiple points and use i++ expecting it to change the object when it really changes the actual object i is pointing to.
    14. Re:Point by point by Fweeky · · Score: 2

      Um, no, I'm talking in terms of ints as immutable objects, not primitive value types.

      Think of how you'd implement it *now*, with a wrapper class around int. All "1"'s in the system will be a reference to your immutable "1" object instance, so without help from the compiler you cannot make a "++" method increment the value, because that means changing the object.

      You either make them mutable, or you make "++" into another assignment operator.

      Obviously it's *possible*, and for Java where it's used so often it's perhaps even a good idea, but that doesn't make it particularly clean, since it just complicates the language for the sake of saving a bit of typing.

  18. Missing the essential by vlad_petric · · Score: 3, Insightful
    The strongest anti-Java argument is its speed. While important progress has been made, key features of the Java architecture make it inherently slow. For instance the fact that the architecture is stack-based makes bytecode very difficult to optimze on machines with a large number of registers

    So in my not-so-humble opinion what Java needs greatly is a completely redesigned & revamped architecture (bytecode & JVM) with compatibility modes, of course.

    Most points discussed in the article are just library-related. Those simply do not justify a new major release.

    The Raven

    --

    The Raven

    1. Re:Missing the essential by CynicTheHedgehog · · Score: 3, Insightful

      And these arguments are based largely on the performance of Sun's JVM. Is Sun's JVM the fastest one out? I don't know, but on many systems it's the only available JVM. Apparently Apple's OSX JVM is pretty speedy, and IBM's got one that is at least as good as Sun's. I'll bet that you can take the existing architecture and make an efficient implementation.

      Or you could look at it this way: the JVM is like an operating system. It handles threads, scheduling, memory management, I/O--this list goes on. And as in an operating system, design choices made for each of these subsystems have an effect on overall performance. Certain scheduling algorithms, for instance, favor I/O-bound processes, while others favor CPU-bound processes. I bet Sun compromised in a lot of areas of their implementation in order to get decent performance overall. I'm sure different implementation decisions will have different results. There just aren't a lot to choose from.

      And Sun was targetting a server-side market from the start. So it's probably safe to say that their implementation favors the Sparc in all its 64-bit glory. I'm sure if someone really focuses on the desktop and kept Swing in mind they could come up with something better for the end user.

    2. Re:Missing the essential by ranulf · · Score: 3, Insightful
      For instance the fact that the architecture is stack-based makes bytecode very difficult to optimze on machines with a large number of registers

      This is just plain wrong, I'm afraid. It just requires that you don't take a simplistic approach converting bytecode to native code.

      If you're converting a function from byte-code to native code, you can easily look at a stack based bytecode and build up a full parse tree for each statement and optimise that for the target platform.

      Besides, how many registers would your ideal JVM have? 4? 8? 32? 256? What if it's run on a machine with more registers? It just won't use them. What if it's run on a machine with less? Well, it'll have to start swapping registers to memory back and forth, and become very inefficient. Using a JIT and a stack based approach, the target code is optimised for the host machine and the JIT doesn't have to worry about what "registers" the code is using for what.

      Perhaps Donald Knuth sums it up better: "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil."

      If you weren't talking about a JIT but a byte-code interpreter, then you'd probably be implementing registers in an array anyway, so your comment doesn't make too much sense.

    3. Re:Missing the essential by alext · · Score: 2

      I think I've found a solution!

      Use Jad first to turn the bytecode back into full source code, and then optimize that.

      Brilliant, eh? I feel a software patent filing coming on...

    4. Re:Missing the essential by j3110 · · Score: 2

      My god man! The JVM doesn't have registers nor stacks. You simply refernce the variables. The JVM itself decides weather a variable is a register or whatever the system supports. That's why Java was written to begin with, to improve portability. Most people can't optimize their C/C++ programs for all CPU's. So, they invented a very very CISC VM. That way a program written in Java can take advantage of all 32 MIPS registers or the 8 or so x86 integer registers and the floating point stack.

      Java isn't slow, java loads slow.

      --
      Karma Clown
  19. Class loader by seldolivaw · · Score: 2

    One point he mentions is making the class loader better -- but he doesn't know how. Amen! I hate the fscking class loader!! :-)

  20. Fill in the blanks by d3xt3r · · Score: 3, Informative
    BTW, the blank overhead was supposed to be SMP. Java threads that take advantage of SMP are a requirement for server side tasks. Again, Sun's Solaris and Linux JVMs and Apple's OS X JVM, all already take advantage of this.

    So much for proof reading. :)

  21. He's a critic by zeus_tfc · · Score: 2

    And I hope we all remember that critics are like eunuchs (as opposed to unix) in a harem: They know how it's done, they've seen it done every day, but they're unable to do it themselves.

    Or so sayeth Brendan Behan.

    --
    "...At the end of the day"..."when everyone goes home, you're stuck with yourself." RIP Layne Staley
    1. Re:He's a critic by kubrick · · Score: 2

      Those who can, do.

      Those who can't, teach.

      And those who can't even do *that* become critics.


      Too lazy to look it up, but it wouldn't surprise me if an author was the source of that comment. :)

      --
      deus does not exist but if he does
    2. Re:He's a critic by miniver · · Score: 2

      I always heard it this way:

      Those who can, do.
      Those who can't, teach.
      Those who can't teach, administrate.
      Those who can't administrate, criticize.
      --
      We call it art because we have names for the things we understand.
  22. Some observations by Twylite · · Score: 5, Informative

    This is a refreshing view on changes to Java, because it doesn't make the traditional calls for templates, a preprocessor, and operator overloading. Most of the article is well considered and logical, and should be implemented in a move to Java 3.

    There are however some issues with which I must disagree:

    • Under the discussion of primitive types, the author proposes that the current wrap-around handing of primitive types is incorrect. Mathematically, yes - but not in computing terms.
      While the overhead of promoting all primitive types to objects may be insignificant, the overhead of checking all arithmetic for overflow does have the possibility of causing significant overhead.
      Not only that, but you will still end up with a RuntimeException, because you cannot expect ALL arithmetic to be in a try ... catch block. So all this becomes is an aid in debugging or forcing a crash (rather than progress based on an invalid computation) on a live system. I have to question whether the performance trade-off is worth it.
      Overflow errors are a well known problem - well-written software should not suffer from them.
    • Still on the primitive types discussion, I don't believe the author has considered the impact of using an arbitrary-size number computing which does not require such numbers. The performance overhead is potentially huge, and you lose the ability to performance a large number of optimisations based on the fact that you are dealing with a quantity of a determistic size (in memory). There are also threading and synchronisation considerations, which I will discuss later.
    • The byte type is unfortunately defined in Java. It should be unsigned, to begin with. It is certainly necessary for many IO operations, and data encoding/decoding; moveover it would be preferable if bytes had the special property that aritmetic operators converted other types to bytes (even if data loss was involved) rather than vice verse.
      Many Java developers are caught by using code like b = (byte)i; rather than b = (byte)(i & 0xff);. It is generally true that when dealing with bytes, you want to keep data as bytes until you explicitly make it into another type.
      Finally, byte arithmetic should always overflow, as is expected in CPUs.
    • Last note on primitives (and it applies to 4-byte chars as well): the assumption we are afforded by Moore's law does NOT apply as the author suggests. Rather, what was designed to run on a low-end Sun or 486 Intel PC is now expected to run on a 1Mhz 8-bit CPU with 32Kb memory.
      While J2ME is not fully Java-compliant (no floating point support, for example), it still largely conforms to the write-once test-everywhere rule, and this is part of Java's attractiveness.
    • Onto the size of chars. This is a bit of a tough one -- which it would be nice to have a 4-byte character, I have dealt with several Java applications which were very String-intensive. They could gobble up 256Mb RAM in a matter of seconds. A 4-byte char only worsens this problem. It is even doubtful that a char object (as opposed to primative) would help, given the overhead that would be associated with the object (at minimum a type and representation lenght - you're back at 4 bytes again).
      More memory is not always a good solution. Java's garbage collection architecture is very wasteful of memory at the best of times; at the worst of times you are using immutable objects like Strings, so you can't pool or reuse the objects. As increasingly more applications handle text because of our new XML obsession, this situation becomes worse.
    • Threading next. I have studied Java's threading model in some detail, including the issue of non-atomic longs. The problem comes down to one of efficiency - again.
      Java implementations typically do not emulate threads on their most common platforms - they make use of the native threading model of the operating system. This means that making a 64-bit operation atomic must involve the use of a lock; so instead of a 64-bit operation taking up 4 times the time of a 32-bit operation, it could take that plus two calls into kernel space.
      As mentioned before, the same is true of using arbitrary-size numbers. Only a number that the CPU can treat atomically will result in an atomic operation without additional synchronisation.
    • With regard to monitors, I fail to see the need for multiple monitors per object. Every object is a monitor, and Java syntax provides for implicit synchronisation on the current object as well as explicit synchronisation on an arbitrary object.
      Thus, to have different types of operations (all implemenented in one object) synchronised on different locks, simply use each in an explicit synchronisation block and have private or protected lock objects specifically for that purpose.
      Decoupling monitors from objects would kill a lot of the ease-of-use that makes Java threading such a pleasure by comparison to many other models.
    • On the other hand, there are many weaknesses in Java threading. It lacks a strongly-defined policy for thread scheduling, which can make the design of complex multithreaded applications very difficult.
      Furthermore it ONLY has monitors as locking primitives, which rules out the use of overlapping locks, which are one of the few effective synchronisation primitives which can overcome weakly-defined scheduling.
      Java would do well to add an additional synchronisation primitive - either mutexes (as error-prone as they are), or interlocked increment-and-compare (which can solve a number of synchronisation problems far more effectively than mutexes).
    • Onto the XML question, and getting to my area of pet hate: The XML Silver Bullet.com. The author's bias towards XML is understandable, but he needs to realise, as do the millions of developers who let the marketting machine think for them, that XML is a poor implementation of a decent idea.
      For a better critique of XML take a look at http://www.eastcoast.co.za/twylite/pml/pml.html" >my anti-XML page (incomplete, but the anti-XML rationale is presented).
      In particular, XML is a very poor choice for the encoding of Java objects, because of its lack of terseness, and the relatively slower speed of parsing XML - both of which impose significant penalties in a distributed environment.
      Some hard facts to back up these claims: in an application I have worked on, we experimented with SOAP instead of our original binary protocol. The result was a 80% decrease in call rate.
      In a few years, the XML phenomenon will wear off, and world+dog will wonder why we are wasting our precious bandwidth on all the overhead. Already WS developers are starting to wonder how it will affect their resources, and we have proposals for a binary encoded XML for the mobile world.
      This "simple" specification is too complex and too overkill for most tasks, so every "lightweight" XML parser on the market conveniently leaves out certain parts of the specification - be it DTD, PI, CDATA, whatever. We already have XML documents that aren't compatible between two parsers, the situation will only worsen.
      And in the end we will realise that it isn't necessary to make computer data human-readable, because really, everything is just a bucket of bytes and a rule on how to view it, and XML is a very, very poor rule.

    Java is not perfect. It is not a silver bullet, and it is certainly not everything to everyone. Instead, it offers an environment that, to a lot of people, is a damn sight better than C++ because it avoids the error-prone complexities and power of the latter. But you must accepts its weaknesses as a trade-off.

    --
    i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
  23. Fix the JVM, Let Others Fix the Language by FreeUser · · Score: 5, Insightful

    As another noted, the JVM is already capable of running multiple processes on Mac OS X. Fix the JVMs for GNU/Linux, FreeBSD, Solaris, and those obscure, mutually incompatible operating systems from Redmond :-), and let others fix (or replace) the language.

    Concentrate on the JVM.

    Already Python can be compiled into java bytecode, and if the capability doesn't already exist for Ruby, it will soon. Similar compilers could be created for any number of other languages (scheme, smalltalk, whatever).

    Java isn't what is important, it is the write (bytecode) once, run (bytecode) anywhere that is important. Whether that bytecode is generated from Java, Python, Scheme, Ruby, or Joes New Language For His CS210 course, doesn't really matter.

    --
    The Future of Human Evolution: Autonomy
    1. Re:Fix the JVM, Let Others Fix the Language by pmz · · Score: 3, Interesting

      Java isn't what is important, it is the write (bytecode) once, run (bytecode) anywhere that is important. Whether that bytecode is generated from Java, Python, Scheme, Ruby, or Joes New Language For His CS210 course, doesn't really matter.

      I'm suprised that this fact just doesn't come up often when debating Java vs. the .NET runtime. Any language that will work well on a stack-based architecture will compile very nicely to the JVM.

      Even though I really know nothing about C#, I suppose even it could be ported to the JVM, because C# is touted as a Java clone. Microsoft markets a "migration path" from Java to C#; does Sun do something similar for C# to Java? I have seen that there are Visual Basic to Java options.

      Another interesting question is whether the GCJ implementation can handle non-Java bytecode. Imagine being able to write Java, Scheme, or Python source, distribute it as bytecode, and, if the end-user wants native binaries, they just run it through GCJ. JVM + GCJ has a lot of potential to be very formidable against .NET.

    2. Re:Fix the JVM, Let Others Fix the Language by crisco · · Score: 2
      This is probably the most important comment I've read.

      I think the author of that article even touched on this possibility. The only issue is one of acceptance. Java programmers (except those guys from IBM) have come to accept Sun ONE with a whole different meaning, if it doesn't have Sun's blessing it isn't really Java and it isn't really worth using.

      The real issues are the proposed changes to the class library and the real VM changes underneath everything. The class library changes could proabably be accomplished easily, the VM less so. But whats stopping anyone from writing a Jython style bytecode compiler for the proposed Java 3 and calling it Coffee Ground 3 or some such thing? Throw in the proposed library changes as a sort of 'wrapper' and you at least have a proof of concept version. But again, without Sun's blessing, without BEA and Jbuilder and such coming on board, you're without enough mindshare to get the market traction that would make this worthwhile.

      --

      Bleh!

  24. Nitpicking from a professional programmer by _LORAX_ · · Score: 5, Insightful

    10 ) Ok, but what about moving to a better system where you can compile against a specific version. Try to compile agains 1.3 with methods that were depreciated and it will fail.

    9 ) Ok, within the java API the naming convention should be consistant. Outside of the API it's the programmers decesion. To dictate a style of writing would place an undue burden on programmers

    8) No, not on your life. You can take my primitives from my cold dead body. If you want to suggest that primative should not be used in most production applications that's fine, but their is a time and a place for priatives that are very important. Suggesting that we get rid of primatives severly hurts your credability.

    As for your comment about 2b + 2b != 4b... No shit you add two SIGNED 32bit values and expect it to work properly despite the buffer overflow! BigInteger is part of java.math and is a perfedt counterpart to Integer, but can be as big as you want.

    7) Um, mabye. Chars are already expected to represent string and I doubt there would be much resistance to having a JVM decide how big those should be. It's not like he's trying to suggest that short should be changed ( oh... yea ).

    6) I can see some cleanup here. Threadgroups could go away and 99.9% of people would not care. As for the non-atomic nature of 64bit+ primatives that has alwyas been clearly documented in the spec. It does not guarentee atomic operations on anything longer than 32bits. Although this could be changed it was always a trade off between the smaller systems and the larger systems that java would be running on.

    5) No, please, no more bloat. XML is great, but to continue to add LARGER API's with memory hungry requirements to the system is a death sentance.

    4) Smoking the BAD crack. AWT has it's warts and problems, but just look at mozilla on the MAC for all the reasons that native widgets should continue to be supported at all costs. I would not mind an alternate WM/WT as long as it had true native peers so that java can participate as a first class application on all platforms. AWT currently is poorly designed to handle the diffrences between OS's and take advantage of the niceties on some platforms, but that's no reason to abandon native widgets.

    3) Java has two sets of collecations. Ove that was based on 1.1 ( Vector, Hashtable ) and one for Java2 ( List, HashMap ). Anybody that's bothered to read a performace tuning book would realize that the Java2 collection system ( although without generics ) is by far the better system. The Java2 system allows either synchronized or non-synchronized operation. This is because the vast majority of java collection use is internal to a class or method where syncronization just adds a burden to the system. Why use a beartrap for holding your desk pens when a cup would work just as well.

    2) Yes, count me in. The I/O subsystem uner java it totally inoperative for many tasks. A RFE currently pending ( for several years ) is to adda simple way of finding out how much free space is availible on the filesystem. Metadata information is a casulatly of war. It just needs to be tossed out.

    One thing that he doesn't hit on, but it a REQUIREMENT for interoperability is some standardized way of doing fixed block decoding/encoding ( think struct ). It's just amess trying to get complex binary structures into and out of java without going quite mad.

    I don't agree that Streams should be buffered by default as that can CAUSE problems. Buffering should alwyas be under the control of the programer.

    1) Yes, it's already known that the current class loader has some issues, but they are working on a better one. There is no reason to throw the baby out with the bathwater. Many advanced programs are running into problems expecially when they are using custom class loaders.

    But.... he didn't even mention quite a few issues I have personally with my big pet peve being....

    The GC. Many programs need some feedback and some wat to hint or force the GC of specific objects ( since they peer with NATIVE blocks of ( memeory/code) ). It's very important that the programmer be able to programmaticly control SOME operations of the GC subsystem. I'm not asking for malloc/free, but there are some objects that can be a pain to work with and some programming requirements that cannot be achived under the current GC system. It's a black box without any feedback. I would like to be able to tell the GC when I have 10ms where I know the system's time would be better spent cleaning up after itself to go ahead nad do it. I need to be able to force the cleanup of specific classes/instances when they are holding on to native resources.

    Anyways..... I think I've rated enough. I can see where this guy is comming from, but most of his points are whining or ignorace of the system.

    1. Re:Nitpicking from a professional programmer by StrawberryFrog · · Score: 3, Insightful
      No, not on your life. You can take my primitives from my cold dead body. If you want to suggest that primative should not be used in most production applications that's fine, but their is a time and a place for priatives that are very important. Suggesting that we get rid of primatives severly hurts your credability.

      And your reason is? You have of course studied the way that C# does this, keeping both primitive-type-speed and uniform-object-hierarchy uniformity?

      As for your comment about 2b + 2b != 4b... No shit you add two SIGNED 32bit values and expect it to work properly despite the buffer overflow!

      Um, I think that's his point: Bits & buffers & overflows are right for data, addition working properly without the potential for buffer overflows is for integer math. The two are very differnt things.

      --

      My Karma: ran over your Dogma
      StrawberryFrog

    2. Re:Nitpicking from a professional programmer by bnenning · · Score: 3, Insightful
      Suggesting that we get rid of primatives severly hurts your credability.

      (Must...resist...spelling...comment.) Why? Using primitives with objects (especially colllections) is ugly, inconvenient, and inefficient. If properly done, speed won't suffer and you'll continue to use operators on int and float "objects". Much as it pains me to say it, C# does this right.

      BigInteger is part of java.math and is a perfedt counterpart to Integer, but can be as big as you want.

      Right, and if primitives and objects were merged it would be much easier to use BigInteger and BigDecimal, since you could use standard operators instead of clunky methods, i.e. "bignum += 2" vs bignum = bignum.add(new BigInteger("2")).

      I can see where this guy is comming from, but most of his points are whining or ignorace of the system.

      XML is great, but to continue to add LARGER API's with memory hungry requirements to the system is a death sentance.

      Huh? He's talking about using XML as the serialization format instead of the current binary format. It doesn't change the API at all, nor add bloat. Text formats are almost always better than binary, and as the author points out, it may actually improve performance.

      I can see where this guy is comming from, but most of his points are whining or ignorace of the system.

      I guarantee that "this guy" knows far more about Java than you.

      --
      How to solve most of our problems: 1.Lots of nuclear plants. 2.Cure aging.
    3. Re:Nitpicking from a professional programmer by pHDNgell · · Score: 2, Insightful
      8) No, not on your life. You can take my primitives from my cold dead body. If you want to suggest that primative should not be used in most production applications that's fine, but their is a time and a place for priatives that are very important. Suggesting that we get rid of primatives severly hurts your credability.

      There's no reason to tie such things together. Primitives are a design flaw in the java language (not the VM). There is no reason to have a distinction between the primitive int and the Integer object. A reasonable compiler should be able to see how the variable is being used and do the right thing. See Eiffel. In Eiffel, everything is an object, yet performance is amazing.

      --
      -- The world is watching America, and America is watching TV.
    4. Re:Nitpicking from a professional programmer by p3d0 · · Score: 2
      Suggesting that we get rid of primatives severly hurts your credability.
      Ad-hominem arguments hurt your credibility more. He posted lots of fairly convincing reasons that primitives are not necessary. Do you have any actual reasons for thinking they are?
      --
      Patrick Doyle
      I mod down every jackass who puts his moderation policy in his sig. Oh, wait a sec....
  25. Top ten reasons we need Java 3 by selectspec · · Score: 5, Funny

    10. Java 2 isn't big enough.

    9. Cool 3D-glasses marketing gimick potential

    8. We can all complain more when MS doesn't support it.

    7. Library need another complete overhaul of the GUI classes.

    6. Add in all of the C/C++ features that we're left out.

    5. O'Rielly can sell another series of books (how about a fungus?).

    4. Since all of the people who know Java 2 are unemployed, this project will keep them off the streets and out of trouble.

    3. Java doesn't have enough incompatibility issues as it is. We need to level the playing field.

    2. 'Cause the alternative is caving in to C#.

    1. Emacs is better than vi.

    --

    Someone you trust is one of us.

    1. Re:Top ten reasons we need Java 3 by tomhudson · · Score: 3, Funny
      And reason number 11 - so that all the java programmers can finally get fed up, switch back to C/C++, and learn how to use malloc, pointers, and free properly!

      Seriously, lt's not cave in to C!so#

    2. Re:Top ten reasons we need Java 3 by CynicTheHedgehog · · Score: 2
      4. Since all of the people who know Java 2 are unemployed, this project will keep them off the streets and out of trouble.
      I know the parent post was meant as a joke, but I'd just like the point something out.

      A coworker of mine came across an article in some trade magazine that said demand for Java developers is actually on the rise...something like 11% annually. And no, I can't back that up with a reference--it was just something mentioned in passing. But the evidence supports it--Java is actually huge in the enterprise server market. Java-based J2EE application servers sell for $15,000/CPU, industrial sized applications like MetaSolv Solution go for thousands per seat, annually, and it seems as if both IBM and Oracle threw their respective lots in with Java a long time ago.

      Considering that all of thise software runs at the heart of many corporations, and that it's something they can't scale back, it seems like there's plenty of money (i.e. employment opportunities) in Java.
    3. Re:Top ten reasons we need Java 3 by humboldt · · Score: 2, Insightful

      1. Emacs is better than vi.

      You almost had me until that...

    4. Re:Top ten reasons we need Java 3 by scrytch · · Score: 2

      And reason number 11 - so that all the java programmers can finally get fed up, switch back to C/C++, and learn how to use malloc, pointers, and free properly!

      malloc? wuss. real men use sbrk()

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
  26. Why not just drop the depricated... by zenyu · · Score: 2

    I can't agree with the dropping of primative types, since they are just so darn useful for graphics programming. But I wouldn't mind if the methods first depricated in JDK1.2 (Java 2, right?) were eliminated in Java 3. It would require a little bit of fixing for me, since I've used them for backward compatibility, but only an hour or two per program.

    Dropping the original IO or AWT would suck because at times they are 10x faster than the newer equivalents. I learned that by porting, then screaming, then unporting. I wouldn't mind if AWT and the original IO were lost in Java 4, after being depricated when Java 3 is introduced. Then we can push for the performance and completeness increases in those before we have to use them, perhaps by carefully refactoring the newer stuff not to depend on the old, nativizing some things, etc. So a JColor would be introduced for instance. The new io is too complex, but it is the complex we know ;P

    Porting code to a new languange is no small thing. I'd rather port to C++ if the effort is that large, it has become a lot more standards compliant in the last 7 years...

    I know people that complained Java 1.3 wasn't backward compatible enough because of how it treated anonymous packages. I can see those ppl switching to C#.

  27. Re:Arse by bje2 · · Score: 3, Insightful

    10. Get rid of deprecated methods - don't be an arse, ruins past compatability with no benefits.

    people shouldn't be using deprecated methods anyway...that's why they're deprecated, becuase they may not be supported in future releases...this makes perfect sense...

    Eliminate primitive data types - oh yeah, please let me do x = new Int(1) + new Int(3);

    did you even read his explanation??? from the article: "The new byte, int, long, double, float, and char classes would still have the literal forms they have today. Just as the statement String s ="Hello" creates a new String object, so too would int i = 23 create a new int object."...the way you use them wouldn't change at all...in fact this would totally eliminate the need to create new Integers, Doubles, Booleans, etc, when you wanted to put primitive things in lists, hashmaps, etc...that's a big pain now...

    --

    "Facts are meaningless. You could use facts to prove anything that's even remotely true." - Homer Simpson
  28. Ugh. I Disagree. by dasmegabyte · · Score: 2

    Normally, when somebody says "Upgrade Java," I wholeheartedly agree. But what Harold (a good writer, two of his books sit on my desk falling apart) suggests is in many ways just foolish.

    Removing deprecated methods may seem like a good idea, but a lot of the deprecated methods, Thread.stop() especially, are essential parachutes. If a thread stops responding in a manner that's untestable, or if it's within an anonymous class, you need that method...deprecated, dangerous or not. Similarly, making the language more long winded does not really help us. The appreviations in java can be counted on two hands, and they're all things we use pretty often. What's next, extending String.valueOf() to UnicodeTextualString.returnTheValueOfThisInteger() ?

    Primitive types are nice to have around because they optimize sweetly and can be trusted as the the fastest part of an app. Relying on machine speed to clean up the bloat of using too many objects is what's going to make CLR kill Java in the benchmarks (that I guess we're technically not supposed to do anymore).

    Ditching the AWT means ditching all browser support. NO! Furthermore, XML is not the darling of the planet that it purports to be. I like my tiny, efficient serialized objects; easily compressed and not very human readable. I don't want to conv to Base64 and serialize to XML. Why burn those extra cycles just for some ostensible "human readability" when no humans will ever need to read it other than those of us who understand deserialization?

    There are so many things broken with java -- complexity of class structures, taglibs, the inconvenience of formatting and calendar classes, EJBs, stupid JDBC bugs -- I find it troublesome that Harold's biggest issue is the spelling of InetAddress. He knows damn well why it can't be InternetAddress...that's used in javax.mail.internet for a totally different task! He wrote the damn book that taught me that package!

    --
    Hey freaks: now you're ju
  29. Java and Learning from the .NET CLR by benjfowler · · Score: 2, Insightful
    As both a Java and C# coder, I'd like to comment on two of the points raised in the article: primitive types as classes, and the class loading mechanism.

    ERH makes some excellent points in the article, which happens to touch on a couple of issues I've felt is mediocre in Java, but moderately cool in the .NET Common Language Runtime - things that could do well in being transplanted into the Java language and runtime.

    The .NET CLR, being a relatively recent creation has naturally gotten the benefit of 20-20 hindsight. Two area that it seems to do better than Java is of course, class versioning/loading and the issue of primitive types in Java.

    For those of you who aren't familiar with C#, it implements it's primitive types as "value types" (as opposed to the familiar reference types we know and love from both Java and C#). Value types are passed by value (but can be boxed if you need to take a reference to an instance of a value type). The .NET CLR type system imposes some restrictions on what you can do with value types (I can't remember what they are offhand, sorry), but they enable value type instances to take up a very little space, making them virtually as efficient (time and space wise) as the "atomic" primitive types currently in Java. Would the introduction of primitive types as classes be so inefficient as other posters are claiming. I think not.

    In the .NET CLR, you don't have no bloody CLASSPATH, but you do have two types of assemblies (private and shared), assembly probing (standard "protocol" for searching for dependancies of a given module), a powerful way of tweaking module loading through user-written configuration files, and a neat versioning model.

    I highly recommend all haters of Java's class loading mechanism take a look at how the Microsoft people have done it. This is seriously good work.

    MSDN: How the Runtime Locates Assemblies

  30. Re:not if he wants everything to be an object by sbrown123 · · Score: 2, Insightful

    >>Really there's no overwhelming reason the primitives can't remain as built-ins. They just need to behave in the same way as objects.

    What do you mean in they have to behave like objects? So do they become garbage collected like regular objects? Can I serialize them? How about extend them? How does the equals() work?

  31. True... by artemis67 · · Score: 4, Insightful

    Microsoft would like nothing better than for Sun to release a version of Java that isn't backwards compatible. That would give them two options:

    1) Stick with the old Java 2 VM for a really really really long time, claiming backwards compatibility, and watch Sun fall on its face, or

    2) Upgrade to Java 3 immediately and watch everything break.

    Either way they obey the letter of the law, and it gives MS an opportunity to really push C# as developers get frustrated with the transition.

    1. Re:True... by pmz · · Score: 2

      Microsoft would like nothing better than for Sun to release a version of Java that isn't backwards compatible.

      Don't forget that Sun offers directly from their home page the current Java Runtime for Microsoft Windows. Just because Microsoft doesn't ship a current version of Java doesn't mean that Java is any worse off for it.

      If Sun decides to make something like this proposed Java 3, they will simply make it available for Windows just as they do for Solaris and Linux. Also, Sun will obviously provide support for several years for Java 2, just as they do for their other products, such as Solaris, that go through transitions.

  32. Re:hmmm by Twylite · · Score: 2

    RTFS (statement):

    to a lot of people, is a damn sight better than C++

    There is a domain of usage suitable for any given language. To a lot of people, Java is far better than C++ in the domain in which they work. You even acknowledge this.

    Java cannot be applied to operating systems because it does not have the syntax or functionality to control hardware with the required precision. Java recognises that by providing JNI.

    Office suites and web browsers represent a huge amount of code investment - something only one company (Corel) has been willing to risk given the infancy of Java at the time. Were MS, Corel, Lotus etc to start on a level playing field right now, with all their knowledge, and expertise in the language of their choice, but no existing code base, the choice of technology (out of C++ or Java) would be a very interesting question; but my bets would be on Java to deliver a robust solution in a shorter time. The primary factors holding Java back for these applications are the performance issues in Swing, and the poor integration with the platform look and feel.

    Just because you are not competent in C++ does not mean it is inferior to Java

    Actually, this is CONTRARY to a basic rule of software engineering, which is that the best tool for the job is the one you know. No team can deliver a robust, quality solution based on a platform with which it is not familiar.

    That said, I am an experienced C++ and Java programmer (amongst others), and work extensively with cross-platform products in both languages. Each has their place, but for every application where the requirement for stability has outweighed the requirement for speed, I have found Java the correct solution.

    Even where speed has been a tantramount consideration, there has been a cost benefit in using a Java implementation (shorter development cycle and quicker time to market versus more expensive hardware).

    --
    i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
  33. Talk to the gcc folks by grendelkhan · · Score: 2

    Isn't this what keeps happening with sucessive versions of gcc? We're already seeing binary issues with 3.1.x and 3.2 compiled programs, if Linux users are expected to suck it up, what's the difference?

    --
    Wu-Tang Name: Half-Cut Skeleton Get your own Wu-Na
  34. SWT by DigitalDragon · · Score: 2, Insightful

    May I suggest to include SWT into next release, this GUI implementation is far more superior than Swing, much cleaner and faster. For more information please go to: www.eclipse.org

    --
    http://dtum.livejournal.com
  35. Re:once burned... by the+eric+conspiracy · · Score: 3, Insightful

    In several decades of programming (assembler, fortran, algol, PL/1, C, C++, ...) I've never had code written in one year fail in the next.

    You must not have done much work in C++ or C. The K&R C to ANSI C transition broke many of my programs, and C++, well, all I can say is that I remember having to make changes to my C++ code almost every time a new compiler version was introduced in the early 90's.

  36. Threading by Amazing+Quantum+Man · · Score: 2

    "Java was the first major language to integrate multithreading as a fundamental feature rather than a special purpose add-on library."

    Obviously the man has never heard of Ada83. OK, they were called tasks instead of threads. They were still threads.

    --
    Fascism starts when the efficiency of the government becomes more important than the rights of the people.
    1. Re:Threading by Amazing+Quantum+Man · · Score: 2

      Rendezvous was the official interthreading/synchronization mechanism. Ada tasks are independent threads of execution within a single process. Please explain how that is different from "threads".

      Yes, I have used Ada83. The semantics and synchronization are radically different from Java, and from the threading model we've come to adopt, but that doesn't mean that they weren't threads.

      --
      Fascism starts when the efficiency of the government becomes more important than the rights of the people.
  37. Re:I strongly disagree. by SnapShot · · Score: 2, Funny
    MI does not exist in nature
    Oh sure, tell that to Mom and Dad.
    --
    Waltz, nymph, for quick jigs vex Bud.
  38. remove tokenizers?! by HaiLHaiL · · Score: 2, Insightful

    removing confusing and unnecessary classes like StringTokenizer and StreamTokenizer

    wtf? obviously this guy has never parsed anything in java. StringTokenizer is infinitely useful (though I must grudgingly confess to liking c#'s String.split(char[]) method). StreamTokenizer is much harder to use, but very helpful for parsing CSV files.

    geez, don't throw the baby out with the bathwater. that includes leaving my primitives in place too.

    --


    reech bee-yond ur clip-0n
  39. Re:Not the answer by sunking2 · · Score: 2

    Of course it works, but it isn't at least what I would call the correct model (My opinion only).

    Using the typical ISA/HASA comparison between inheritance and composition a flyingboat IS A plane and IS A boat. It's not an object that HAS A plane and HAS A boat.

    Sure, you've created an object that works the same but doesn't really model the objects at hand.

    try this call with the above:
    class airport {
    takoff(plane);
    }

    ..
    ..
    airport.takeoff(flyingboat);

    it won't work real well.
    Multiple inheritance is really my only gripe with java.

  40. Re:SOAP != RPC by Twylite · · Score: 2

    Please read the SOAP specification. It was born out of XML-RPC, and developed (amongst others) by the same author. Its initial and primary focus was remote method call, which is merely RPC in an object environment.

    While it can be used for asynchronous notification, the specification deals mostly with the request and response case, where an identified function is invokved on a server and the invocation is provided with supplementary data (arguments), while the client waits for a responses which can contain arbitrary data (return value, possibly an object or structure) or out of band return data (and exception).

    SOAP was intended to kill XML-RPC, and to add functionality over and above XML-RPC (such as callbacks / notification). It is still an RPC mechanism at its core.

    --
    i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
  41. myArray.length, myVector.size(), myString.length() by eyefish · · Score: 5, Insightful

    I love Java's simplicity, and wouldn't mind to keep it as it is (although I WOULD adopt the proposed changes for Java 3), but the following is what drives me nuts: Three COMPLETELLY different ways to get the length/size of things:
    myArray.length
    myVector.size()
    myString.length()

    It also drives me nuts having to convert all the time between the primitive data types and the Object data types (int/Integer, long/Long, etc).

    Other than that, even with its current flaws I simply have to love Java (I guess is like being married to someone who is not perfect, but that you wouldn't change for anything in the world...)

  42. This is flamebait... by alispguru · · Score: 2
    ... but I can't resist it. This laundry list is an instance of "all programming languages evolve toward Lisp, specifically Common Lisp. Of the ten points mentioned in the article, Common Lisp has had answers to almost all of them, ever since about 1985 or so.
    10. Delete all deprecated methods, fields, classes, and interfaces.
    When CL deprecated things, it did so by creating a new default top-level namespace (a "package" in CL terms) and leaving the deprecated stuff behind. The old namespace and the new one shared most symbols, so old and new stuff could coexist, but in general deprecated stuff would be flagged and had to be specifically requested for it to work.
    9. Fix incorrect naming conventions.
    CL is in general not case-sensitive, so it ducks the properStudlyCaps problem. CL names have always been unabbreviated except for a few historical symbols.
    8. Eliminate primitive data types.
    Never had 'em.
    7. Extend chars to four bytes.
    The exact size of the char datatype is not part of the CL specification. Implementations can and have made it bigger over the years, and programs that care can check at runtime if the implementation has big enough chars for their purposes by making a specified environmental inquiry.
    6. Fix threads.
    Threads aren't part of the CL language. Every major implementation has them, though, and all of them are easier on programmers than Java's threads (see here - scroll down about halfway to "You can't close over anything but final variables in an inner class!").
    5. Convert file formats to XML.
    Always had S-expressions as a default universal file format. See my .sig below.
    4. Ditch the AWT.
    CL doesn't have a specified GUI. The closest thing it has is CLIM, which had a lot of the speed and resource problems Java GUIs have. We had them ten years ago, though. The commercial CLIM implementations are quite useable these days.
    3. Rationalize the collections.
    CL's collections have always been rational. It mostly comes from #8 above - when objects are typed and variables are not required to be, most of your problems go away.
    2. Redesign I/O.
    CL's abstract interface to filesystems and pathnames has always been less Unix-centric.
    1. Redesign class loading from scratch, this time with human interface factors in mind.
    I gather a lot of his complaint here stems from the distinction in Java between an interface and a class. This distinction is there because of the Java designer's allergy to multiple inheritance, which CLOS has had since day one.

    There, have I pissed enough people off yet?
    --

    To a Lisp hacker, XML is S-expressions in drag.
    1. Re:This is flamebait... by scrytch · · Score: 2

      To a Lisp hacker, XML is S-expressions in drag.

      There's only one problem. Within one second of eyeballing this, tell me which "tag" is getting closed given the number of close parens:

      (foo (bar (baz (mumble (frotz (quux (blerg (feh (foof (yay )))))))

      Yes, there are syntax hilighting editors ... it seems odd to rely on one in a language that claims to have no syntax...

      --
      I've finally had it: until slashdot gets article moderation, I am not coming back.
    2. Re:This is flamebait... by alispguru · · Score: 2
      Within one second of eyeballing this, tell me which "tag" is getting closed given the number of close parens:

      (foo (bar (baz (mumble (frotz (quux (blerg (feh (foof (yay )))))))

      We both know the real problem is not little expressions like this, but multi-page nightmares that you would want editor support to check anyway. Hell, even vi has a lisp mode. Let me know when it sprouts an XML mode.
      Yes, there are syntax hilighting editors ... it seems odd to rely on one in a language that claims to have no syntax...

      S-expressions don't have "no syntax" - they have a small, simple, regular syntax. Writing an S-expression reader/printer is an undergrad homework assignment. Writing an XML parser, on the other hand, is at least a semester's project, if not more. Here are some ot the the explicitly-stated design goals of XML:
      4. It shall be easy to write programs which process XML documents.
      6. XML documents should be human-legible and reasonably clear.
      7. The XML design should be prepared quickly.
      8. The design of XML shall be formal and concise.

      All of these are affected by XML's baroque syntax, and I'd say it missed all of them, mostly because of this design goal:
      3. XML shall be compatible with SGML.
      --

      To a Lisp hacker, XML is S-expressions in drag.
  43. Rebuttal by Hard_Code · · Score: 5, Insightful

    10. Delete all deprecated methods, fields, classes, and interfaces.

    While I would also like to see these die, to tell the truth, Java has done an above average job here. In most other (should I qualify that as "practical") languages, there isn't even a concept of deprecated. Deprecated is your client calling you up and telling you something is breaking in a weird way and you say "oh yeah, don't use that". In Java when you deprecate something it means something. The compiler compiles in a flag, and anything that is built against deprecated methods, the compiler will spit out a big fat "THIS IS DEPRECATED" warning. You can't do much better than that. So while I'd like to see these things gone, the reality is that there is a lot of code that is using them, and they really aren't doing much harm. The most "harmful" are the deprecated thread operations. Everything else has mostly been for name changes or additional functionality. Take the most out of your own eye first and all...
    This is just a library issue, not a language issue.

    9. Fix incorrect naming conventions.

    Amen. Given that we adhere to whatever we resolve to do with deprecations, fine. But again, Sun has done a terrific job, and if you look through the libraries, I'd say 90% or greater (including deprecated stuff) adheres pretty well to the standard. Again, this is just a library issue, not a language issue.

    8. Eliminate primitive data types.

    What you want is "boxing" (like C#/.NET/CLR does), and they're already working on it: RFE 4609038 Request auto boxing of primitives in Java.

    7. Extend chars to four bytes.

    Meh. I don't use Unicode that much, so it's not as relevant to me, I'll trust you on this one. Just don't bloat up good ole US-ASCII character strings.

    6. Fix threads.

    I generally agree. The first 5 bullets are pretty trivial. I have never ever run into a problem when using threads, even with complicated synchronization implementations. The last bullet is already possible: write your own damn monitor! Nobody is stopping you as long as the sychronization primitives work. Here I'll give you a clue: custom monitor implementations. Easy as cake. I'm not sure what the author is really asking for here. Sun cannot possibly make every single implementation of a monitor somebody would like (ok, well, it *could* but why?). It gives you the primitives and you go from there. That is why you are a programmer.

    5. Convert file formats to XML.

    No no no no no no NO. XML is not a panacea. Please DON'T turn everything into XML. The formats that exist (properties format, manifest format) are simple and designed for their purpose. XML has its uses, and simple, flat, non-hierarchical, terse data, which has absolutely no expectation of being rendered visually or translated into another form, is not one of them. I don't see any REASON being proposed other than "everybody is using it". Well, if everybody jumped off a bridge...

    4. Ditch the AWT.

    Meh. I have a better one. Replace AWT with a natively back-ended Swing or Swing-like API, akin to IBM's SWT. Swing is a lovely API, but it is cumbersome to lug all the libraries around, and it is slow. SWT is a nice compromise (nice high-level abstract, generic, Java API - to the metal native implementation).

    3. Rationalize the collections.

    This is basically an argument against the deprecated classes, for which there are already replacements. I don't see much wrong with the Collections API (i.e. java.util 1.2+), and when generics arrive, it will be much more useful (no tedious subclassing or casting to contained type). The author is making some fuzzy argument that the Collections APIis not cuddly enough or something. It's a starting point - it has the most used structures (hashtable, linked list, growable array, etc.). If you don't like them, feel free to subclass or write your own. They are fine for me, and certainly don't rank up at 3 as far as complaints to Sun go.

    2. Redesigned I/O

    A bunch of non-arguments here. Again, for something like 90% of the time, this is going to do you just fine. Please DON'T sneak buffering into classes which do not announce this fact. This is the charm of composition, and I think it works nicely. Want a stream buffered? Wrap it with a buffering stream. Want a stream GZipped? Wrap it with a GZip*Stream. Anyway, there IS a new IO API, which promises much better performance (introduces asynchronous I/O), java.nio.

    1. Redesign class loading from scratch, this time with human interface factors in mind.

    Agreed. This is getting to be a headache. Especially when deploying in application servers/servlet engines that have their own custom classloaders. There probably isn't a good solution other than good documentation, and reduction of unnecessary conflicts when security is obviously not an issue (the whole reason of seperate classloaders to begin with).

    Summing Up

    Well, this article is largely gripes about the library not the language, and where it gripes about the language, those gripes are already being addressed. I would complain about things like, methods not being first-class objects (callback classes are really annoying), unspecified symbol resolution in the language spec, inner classes not being allowed to have static declarations, lack of enumeration type in the language itself, interfaces unable to declare overridable fields, array types being pseudo objects when they could instead be easily made to be real objects which could be subclassed, etc.

    --

    It's 10 PM. Do you know if you're un-American?
    1. Re:Rebuttal by Tablizer · · Score: 2

      (* Please DON'T sneak buffering into classes which do not announce this fact. This is the charm of composition, and I think it works nicely. Want a stream buffered? Wrap it with a buffering stream. Want a stream GZipped? Wrap it with a GZip*Stream. *)

      I would like to see these as named parameters or option switches rather than wrappiing.

      Psuedocode:

      myStream = new Stream(buffered=No, compressed=Yes, .....)

      That is more compact and natural IMO. Plus, you get "reasonable" defaults if you specify no options. IOW, hide the details.

  44. Java does not need generics by Martin+S. · · Score: 2

    What you really need is generics (as in C++ templates). Java collections are vile, since they suffer from type loss even when used with "real" objects. I'm surprised that didn't come into this top ten; it's a major language deficiency.

    I should have predicted this! What is it about generics advocates ? You never quit harping on about this even though generics have been repeatedly rejected by the JCP.

    Java needs Generics like a People need holes in their heads. They are pointless, cannot be added without badley breaking the VM, they add nothing except complexity; produce code bloat, break type safety and are hated by the real OO experts, because they are a crutch for people who do not understand polymorphism.

    I'm really forced to wonder about the motivation of people who want to so badly break Java.

    1. Re:Java does not need generics by cartman · · Score: 2

      Your post is a bunch of random nasty assertions with no supporting logic whatsoever.

      > Generics are pointless.... break type safety..

      Generics BREAK type safety? At present, objects are retrieved from a collection by typecasting them! Collections are already absolutely type-unsafe. Generics are to FIX this problem. How do generics ruin type safety?

      > ...they are a crutch for people who do not
      > understand polymorphism.

      What? Generics have nothing to do with polymorphism. They don't break polymorphism, and polymorphism does not provide the mechanism that generics provide.

  45. This is why Sun has not made Java open source by coldtone · · Score: 2, Insightful

    If it was open source we would already have multiple versions of Java and they would all be incompatible with one another. You would have the neat freaks going with a version of java that has the articles fixes, and would completely ignore backward compatibility (Because after all were going to do RIGHT this time!), you would also have the hacker crowd who would make Java++# that would include pointers and remove garbage collection and also make it incompatible with existing code. (Because they are making it RIGHT as well).

    In a few years the language would be forked just as bad as C.

    Thank God Sun hasn't Open Sourced it.

  46. But they'd be immutable by apsmith · · Score: 2

    int i = 23 as in his example would, if I understood correctly, make a construct like i++ impossible. How would a for loop work? This doesn't quite make sense to me - maybe you'd need both mutable and immutable classes for the primitive types?

    --

    Energy: time to change the picture.

  47. I find it odd he didn't mention this one: by JustAnotherReader · · Score: 2, Interesting
    1. Operator overloading. If a String class can do this:

    String foo = "Hello ";
    String bar = "World.";
    String foobar = foo + bar;
    // fobar now equals "Hello World"

    Then why shouldn't I be able to write a Matrix class that has addition, multiplication, and equals overloaded to be matrix addition and matrix multiplication? Which of these two examples looks like clearer code to you?

    // assume a and b are already defined matrices
    Matrix x = new Matrix(a.matrixMultiply(b));

    or

    Matrix x = a * b;

    But let's not let this turn into a Java bashing forum. Even with it's limitations and frustrations I still love the fact that my favorite programming editor (Jext, written in Java) works exactly the same in Windows 2000 as it does on Linux. I love the fact that I can work on servlet and JSP ideas at home on Linux using Apache and Tomcat and then go to work and flesh out those ideas on Windows 2000 with WebSphere. Then, when we move that program to production it runs on an IBM mainframe running AIX. All without requiring a recompile.

    No language is perfect. Any language can be improved. The 10 points in this article would make Java an even better language than it is now.

  48. Don't confuse implementation with semantics by SimonK · · Score: 2

    Noone (or noone significant anyway) thinks the
    primitive types should be layed out in memory
    the same way as object types. The argument is
    that they should be semantically the same,
    but implemented differently. Thus, if I
    want to take the sine of a number, I can
    write:

    (6.0).sin()

    Rather than:

    Math.sin(6.0)

    Which involves the nasty, irrelevant class "Math". You should also be able to subclass the primitive types. Furthermore you can remove the length and precision limits on the various types. Integers should be stored as 32-bit ints where possible, and then gracefully degrade into big ints when they exceed 32 bits.

    The technology to do this already exists. Lisp and Smalltalk VMs have done it for years. Unfortunately, the developers of Java got confused in just the same way as you're doing.

  49. Generics and Primitives by SimonK · · Score: 2

    Generics are well on their way. They keep getting held back from actualy inclusion in the VM, since in practice their absence is just an irritation, but the standard is already signed off. C++ templates are a pretty poor example of generics anyway. It has been done much better elsewhere.

    You don't really explain why you think the primitive types are necessary, so it is hard to answer you, but the fact there is no common supertype of the primitives + Object is a complete PITA if you do anything complex in Java. Just look at the JDBC interfaces for an example. The need to promote and demote primitives to get them into collections is a major source of inefficiencies in Java programs.

    Just to avoid any misunderstandings: the point is to give the primitives object-like semantics, not to store them in the same form as other objects, or to require people to use object-like syntax. The technology to treat primitives as objects has existed for Lisp and Smalltalk for years. The only reason it hasn't made it into Java is NIH syndrome.

    Another thing he missed: metaclasses

  50. Ahem ... by SimonK · · Score: 2

    That would be why the JCP is working on a standard for them ? and why there is an implementation mechanism (type erasure) which requires only a small change to the VM ? and why 1.5 is slated to include them ?

    Hmm ...

  51. You could avoid the overhead ... by SimonK · · Score: 2

    ... in Java, because it is statically typed. Where code is not polymorphic, and manipulates the primitive types directly, it would be possible to use full-precision numbers, as supported by the hardware, just as Java does now. Something like C#'s automated boxing and unboxing could be used when the primitives were assigned between a polymorphic and a non-polymorphic context. That would answer the performance concerns with needing to distinguish fixnums from reference types, and still give fully OO primitives.

  52. SCCCL by HiThere · · Score: 2

    I find myself quite dubious. I don't particularly like the Sun license, so much so that I haven't even been updating the current versions of Java. (I'm hoping that Python or Ruby will expand to fill the spot where Java currently resides.)

    Sun hasn't given much sign that it intends to improve it's licensing. McNeary's recent comments seem to inticate that it may tighten up on it. And the current license is already a bit much. So I don't think any new version would be attractive. I'd rather trust Miguel's version of C#, but I have this suspicious mind that keeps hinting that MS holds patents that will sink either it, or large portions of it.

    --

    I think we've pushed this "anyone can grow up to be president" thing too far.
  53. and Elliotte Rusty Harold.. by geekoid · · Score: 2

    ...Number 1 reason for Java 3... Needs to make some more money from another book.

    --
    The Kruger Dunning explains most post on /. http://en.wikipedia.org/wiki/Dunning%E2%80%93Kruger_effect
  54. Procedural by Tablizer · · Score: 2

    What about good ol' functions? Even many OO fans agree that "sometimes procedural is the right choice for a particular problem".

    "system.this.that.print()" is a Demeter Principle violation anyhow.

    Also, get rid of the "break" statement, instead allow multiple match items.

  55. Isn't C# Java 3? by Dr.+Awktagon · · Score: 2

    C# is basically Java without a lot of the annoyances. (Unless of course you consider Microsoft itself a major annoyance..) For instance boxing/unboxing primitive types, get/set blocks for attributes (the getXxx/setXxx convention in Java is a little klugdy, imo)...a foreach operator ... enums ... delgates (like "function pointers")...other stuff..

    Basically Microsoft did the usual microsoftish thing, they looked at what's available, ripped it off, and changed the bits that they thought were annoying.

    I must say after reading some C# books on O'Reilly Safari I like C# a lot more than Java and am looking forward to 1) a C#->native code compiler for linux and 2) a C#->Java bytecode compiler (it must be possible).

    The author is right, in spirit (even though I don't agree with every detail). Java is starting to look a little crusty. I believe the reason Java took off so much in the beginning was because people were desparate for a "better C++". Now as time goes on we need a "better Java", as we search for that elusive "perfect language"..

  56. Templates=generics by Aapje · · Score: 2

    Templates are called generics and available as an extension to Java: GJ. This implementation (or at least something very similar) will probably be included in a next version of Java.

    BTW. If you are a member of Sun's Java Developer Connection (free), you can vote for the features and bugs you want them to work on. Vote for Generics! Of course, sharing memory between JVM instances is also a good feature to vote for. It has been proven to be possible already (MacOS X' JVM), so they just need a kick in the ass.

    --

    The Drowned and the Saved - Primo Levi
  57. Ohhhh, wait by The+Bungi · · Score: 2
    For so many years, every time someone came up with a "Top 10 List of things X Should do" we've had to put up with the interminable witty "use Linux" or "use OS X" or "use Java" replies.

    This time around however, I'd like to respectfully point out (as many other posters already have, although they've been mostly modded down as trolls) that every single thing this dude wants Java to do is already in... wait... C#.

    Actually, I think this article was quite the exercise in hipocrisy. For every single point made in the article he could have added "C# already does this" at the end. I'm sure he came up with all those insightful recommendations thanks to a visit from the Angel Of Languages, instead of from intalling and using Microsoft Visual Studio.NET for a few months and reading the ECMA spec for C#. Yeah, I'm sure that was it.

    Microsoft created C# (and .NET) to compete with Java at the enterprise level. I think it's obvious they're succeeding when one of the "leading voices" of Java cries out and demands the very things that are built into C#.

    I actually hope Sun (yes, everyone here loves Java so much despite the fact that it is a language controlled by a single company, like... wait... C#) does all this to Java. That will make it a much more level playing field. But alas, they're paralyzed by the need to have backwards compatibility, which is important regardless of this guy's acid dreams. No company, not even Sun would risk their current user base to clean a language up. Sorry!

  58. Maybe if Java were Smalltalk Instead... by jarober61 · · Score: 2, Insightful

    Sounds like most of the author's complaints have been addressed 20 years ago, in Smalltalk. Now maybe if Gosling had done his reading.....

    --
    Talk Small and Carry a Big Class Library
  59. Re:Ugh. I Disagree. by bnenning · · Score: 2
    Primitive types are nice to have around because they optimize sweetly

    Adding object semantics to primitive types doesn't have to slow things down, C# seems to do it fine. Having separate int/Integer types is a hack that produces ugly and inelegant code, and should be removed.

    Ditching the AWT means ditching all browser support.

    Why? I've run Swing applets in browsers, they worked just as well as AWT applets (which is not very, but still). I actually prefer native widgets to the one-size-fits-all Swing widgets, but Sun disagrees and I don't think they need to expend resources supporting two completely (well, mostly) separate UI libraries.

    I like my tiny, efficient serialized objects; easily compressed and not very human readable.

    And not interoperable with anything else, and prone to breakage with new versions. If you're concerned about size, gzip your XML data and you'll get close to a 90% reduction.

    He knows damn well why it can't be InternetAddress...that's used in javax.mail.internet for a totally different task!

    Classes in different packages can have the same name, e.g. java.util.Date and java.sql.Date (although I'd argue that's also poor naming).

    --
    How to solve most of our problems: 1.Lots of nuclear plants. 2.Cure aging.
  60. Slashdot continues through the backlog? by Inoshiro · · Score: 2

    Java 2 was Java 1.2. Java 3 is Java 1.3. Sun released Java 4 a while ago (Java 1.4).

    Solaris 9 anyone? Oh, right, 2.9... ;0

    --
    --
    Internet Explorer (n): Another bug -- that is, a feature that can't be turned off -- in Windows.
  61. XML (Re:Some observations) by Herbmaster · · Score: 2

    Onto the XML question, and getting to my area of pet hate: The XML Silver Bullet.com. The author's bias towards XML is understandable, but he needs to realise, as do the millions of developers who let the marketting machine think for them, that XML is a poor implementation of a decent idea.

    Of course XML is a silver bullet! JARs and properties files are just the beginning. What we really need is for the .class files to be nice, readable, XML documents. This will pave the way for .java code to be written in a proper XML format. There is no reason that these things need to be written in an ugly properiety format.



    My apologizes if my sarcasm is lost.

    --
    I'm not a smorgasbord.
    1. Re:XML (Re:Some observations) by Twylite · · Score: 2

      You know the problem with the world? There are too many developers out there who will read your first paragraph and say "That is such a cool idea - I'm going to do it right now!" ...

      --
      i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
  62. Re:Ugh. I Disagree. by dasmegabyte · · Score: 2

    It's not that Swing apps don't work in a browser -- more than Swing apps will only work in a browser under certain conditions which are not easily met by average anonymous user X.

    Maybe in a year or so, when all those XP homes have downloaded WebStart and/or NS 6.2+. Until then, I need my AWT to make fancy wavy backgrounds in my shout out pages.

    --
    Hey freaks: now you're ju
  63. Atomic Longs and Doubles not desireable. by ccoakley · · Score: 2

    You hit the nail on the head:

    From the article:
    The non-atomic nature of doubles and longs is a sop thrown to architectures that can't efficiently do 64-bit operations. That's not nearly as much an issue today as it used to be, however, and few VMs ever took advantage of it. If these types aren't made into objects, then they need to be as atomic as the other single-byte types.
    What he seems to be missing is that longs and doubles CAN'T be atomic on some (4 byte) thread capable processors.

    long a;
    a++;

    Will be non atomic on 4 byte processors. In the case of 0XFFFFFFFF, it first becomes 0X00000000 and then as a second operation checks the overflow and becomes the equivalent of 0X0100000000. If a thread switch occurs in the middle of the a++ and the new thread references the variable stored in a, there is a possibility of getting a value 4 billion off of the value that should be stored in there if the function performing this operation was synchronized.

    Solution: lock longs on every operation. Yuck. Just what Java needs, more overhead on numeric operations.

    Question: You point out that Java uses native threads but then complain about a lack of a thread scheduler. Aren't the two incompatible (some kernels hide thread scheduling details)? Would you really want Java to emulate threading as a method of creating a thread scheduler? Also, for single processor systems, thread emulation is fine, but multiprocessor systems don't lend themselves well to emulated threads for actual performance. How do you reconsile the two?

    --
    Network Security: It always comes down to a big guy with a gun.
    1. Re:Atomic Longs and Doubles not desireable. by Twylite · · Score: 2

      You're right - the use of native threading (mostly) precludes the definition of stricter / more reliable scheduling rules. This was intentional in the current Java specification, to allow the use of native threads.

      Frankly, I have no idea how to reconcile the two ;) Unless the specified behaviour is something you can expect to be supported on all implementation platforms (very unlikely).

      My bad experiences with Java threading have been mainly with VMs based on Windows and Solaris, where threads contend for resources in a situation where I can't make the locks more fine grained (the requirements are complex but very specific about the behaviour of threads in resource contention).

      On Windows the software behaves just fine, whereas on Solaris one thread hogs the resources all the time. This is exactly the same behaviour as the equivalent C++ application - but with that the problem could be solved using the wider variety of synchronisation primatives (e.g. overlapping mutexes).

      So, as I suggested, additional synchronisation primative may go someway to relieving the problem; but a more deterministic scheduler would be nicer ... but run into the problems you have accurately described.

      --
      i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
  64. Not taught Java correctly? by Inoshiro · · Score: 2

    An Array is not an object. You merely are accessing a data field in its structure which is R/O. How is this hard to understand? Is is hard to understand that a vector is multidimensional (unlike a string), so its size, not its length is what you want? It makes logical sense to me.

    As for the data types, if you don't want to mess around with the "dirty details," stick to pure Computer Science languages and scenarios. In the RealWorld(TM), you write code that deals with things. I know you want to do things in less code, but it's about working smarter, not complaining about working harder. Write a class which does all the nitty gritty in an easy-to-use interface, and use only that interface. Make it generic and useful, and you'll be able to re-use that object in all your projects.

    As an example of working smarter, take Glade. With it, rather than spending 5-10 lines of code laying out and initializing a widget or part of a widget in a mega-huge init call, I can simple create an xml description file that also has the names of the callbacks for each widget. Then I just write the code to handle the call backs, and include one call that loads my template and populates it. The same is true with PHP. Why should I include hard-coded strings everywhere, when I can load a template and just ereg_replace all the escaped variable names? I can work alongside people using Frontpage or Dreamweaver, and I need never tear my hair out because of it.

    --
    --
    Internet Explorer (n): Another bug -- that is, a feature that can't be turned off -- in Windows.
    1. Re:Not taught Java correctly? by cartman · · Score: 2

      > An Array is not an object. You merely are
      > accessing a data field in its structure which
      > is R/O.

      Incorrect. An array is an object with special syntax. Every array is an instance of java.lang.Object. There are no "structures" in java. Try this:

      System.out.println("Arrays are objects?" + (new int[] {1,2,3} instanceof Object));

      > If you don't want to mess around with
      > "dirty details," stick to pure CS languages.
      > In the RealWorld(TM), you write code that
      > deals with things.

      Not messing around with "dirty details" is one of the goals of almost every language.

      > Write a class which does all the nitty gritty
      > in an easy-to-use interface, and use only that
      > interface. Make it generic and useful, and
      > you'll be able to re-use that object in all
      > your projects.

      I think people know this already.

  65. For another biased view... by alext · · Score: 2

    Autoboxing is of debatable utility - see this critique.

  66. Why not just write assembler? by Inoshiro · · Score: 2

    Because it's less efficient in a man-hours way.

    You can sit down and write out a native code output setup for "common" machines, but then you've just gone and wasted a lot of effort for a sub-2% performance increase (assuming you can duplicate the OO latebinding arbitration and garbage collection any faster in "native" mode without a supporting runtime like the JVM). Each native output compiler would take at least as much man power as the one which outputs the code for use with the JVM. And then you'd need to write some sort of runtime library which duplicated the JVM for the functionality I mentioned above.

    So rather than spending thousands of man hours working on that, why not wait until 18 months from now when your code runs 200% faster? The tiny little "god" of performance is tempting, but don't go towards it if it means sacrificing all the gains from computer science in the past 20-30 years. Assembler is fast, but no one uses it except in device drivers and careful cases where it's found to be more beneficial than doing it in a higher level language.

    --
    --
    Internet Explorer (n): Another bug -- that is, a feature that can't be turned off -- in Windows.
  67. Or with some extra annoyances? by alext · · Score: 2

    See the "Petilon" critique.

    Personally I think they're pretty even, which is something of an indictment of MS's strategic planning.

  68. Don't knock XML too much... by ccoakley · · Score: 2

    What do you suggest for distibuted computing if not XML messaging in some form? IMHO, there is really no way that a C++ developer is going to be able to communicate with a remote Java application except by passing XML. The Java RMI protocol is hard to implement in another language (it serializes exceptions and pipes them across to the remote client in a non-obvious way). I don't know enough about CORBAs model to comment, but opening a socket and sending strings (with inline XML schemas to verify against) is straighforward for all languages. Building your own parser for anything sucks, but there are XML parse libraries freely or cheaply available for any programming language. Also, XML messaging is convenient because you can upgrade a server to provide extra information / functionality without upgrading clients: just spec that unknown tags are parsed and ignored. Also, most XML parsers don't choke on malformed tags. If you write your own protocol using a home brew format, specing that kind of stuff is a real pain in the ass.

    --
    Network Security: It always comes down to a big guy with a gun.
    1. Re:Don't knock XML too much... by Twylite · · Score: 2

      There are several existing standards for the interchange of information between disparate systems, and that includes languages. And a number of those are complete remote procedure call systems.

      ASN.1 has been around since 1984 (or somewhere close), and is a terse binary protocol build for this sort of communication. It is used extensively in the telecoms industry and is supported in almost every language. It is standard, well known, and well suited to the task it is meant for (which includes RPC-style communication).

      ONC/RPC is another standard protocol for RPC supported in the Unix world and support also exists for Windows platforms. It is well documented, and bindings exist for C/C++ and Java, amongst others.

      Opening a socket and sending strings is easy, but it is also slow and error prone. The use of binary encoding for numbers (which constitute a huge proportion of most parametric and return data in typical applications) is far more efficient in terms of bandwidth, processor usage and code quality.

      As for ignoring tags, this is a hack concept introduced by this technology, and is something to be considered with the utmost suspicion from a software engineering viewpoint. Servers should never ignore parameters from a client, as these are (obviously) there for a reason. This type of thing causes subtle errors in distributed applications that are incredibly hard to trace, because they relate to application versioning rather than functionality -- and few organisations have configuration management skills or procedures to match their testing/debugging procedures.

      I'm not recommending home brew. But I am also not advocating (in this situation) a multiply-redundant encoding with unreasonable overhead which is not meant for a high-volume environment. There are many preexisting standards which meat the requirements, but aren't buzz-word compliant.

      --
      i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
    2. Re:Don't knock XML too much... by ccoakley · · Score: 2

      Thanks, I'll have to look into these. Sad Disclaimer: I am teaching a college course in Distributed Computing this Fall. I'm using Java as the implementation language (why? Because it's at a University and the students learn Java first). I was planning on using XML message passing because I have a student that refuses to work in Java (so he ports all of my framework to C++) and I am loath to use RMI. My bandwidth requirements are very low--reconfiguring my problem requires sending an objective function, the clients are genetic algorithm machines, so they consume memory without consuming bandwidth. The distributed computer is headless and unreliable (I am having students with dial-ups participate). My problems for my students all come from my real job working for a defense contractor (mostly scheduling, resource management, and similar OR problems). Due to academia's love for XML I will probably still use it, but I will probably suggest rewriting the protocol in one of the ones you just offered as a group project (and what better way to learn something than to assign it to undergraduates ;) ?).

      As far as the Hack mentality (of ignoring tags): labeling the schema of your XML messages is actually a fantastic low cost way of getting disperate systems to talk to one another. Your argument seems to assume that it is possible to upgrade both the client and the consumer at the same time (but if you've got a better way, I am all ears). In the Navy right now, there are several different contractors with products that talk to each other and have different funding cycles, so the ammount of data passed increases with each version of each product, independent if the listener has been upgraded--and given that we are often fighting for the same dollars, odds are one of us will be upgraded, then the next, then the next, etc. The extensibility model works really well for us in that environment. I put extra information in my XML output, when you get your funding, you actually parse and use them. However, if I have my way, I'll get my next round of funding before you get the chance.

      --
      Network Security: It always comes down to a big guy with a gun.
    3. Re:Don't knock XML too much... by Twylite · · Score: 2

      For academic instruction XML is not a bad idea at all. I believe it is a bad implementation, not a bad concept. It is conceptually ideal for many forms of communication, and has benefits in academia: it is well studied, resources are available, and it is easy to view the protocol in action and dissect every step (without resorting to deciphering binary packets).

      I'm sorry I didn't present the second part of my argument clearly. The problem of ignoring parameters is more serious when you can't upgrade everything simultaneously, and especially when you upgrade the client first.

      For example: a method is upgraded to take an additional parameter "skew" (it just adds that number to the return value). The client happily calls the server, not knowing that the server is running an older version of the software, which ignores the "skew" parameter, and returns the wrong result.

      Careful schema control, and having the client identify its schema/API version to the server is a good way to handle this, but developers are notoriously bad at meticulous API versioning (which falls into the category of tasks I referred to as configuration management).

      The best practice is to clearly separate the two versions of the API -- introduce completely new functions when you need to add parameters, don't simply use what appears to be overloading (but isn't). An alternative practice is to use inheritence to make v2 of the API a subclass of v1, with additional (possibly overloaded) functions.

      Essentially, you need to treat the distributed environment no differently from objects on a local machine. If you add parameters to a method, you must provide a new, separate, overloaded method. Changing the existing method would break existing code which uses it - so you don't do it. If it makes sense to do so, the old implementation can be changed to call the new method with some default parameters - but this is not always the case.

      As a rule, ignoring data is a bad thing. It its not used, it probably shouldn't be there ... and if it's there, it should probably be used ;)

      AAMOI, the Visa 3D-Secure specifications permit certain communication end-points to ignore certain fields for forwards compatibility, but within a strict framework: some servers and/or messages cannot ignore fields, and any field of any message can be marked such that the recipient MUST understand the field, or force the transaction to fail.

      But, it must also be understood that the Visa framework does not operate using SOAP (or a system where the target function is indicated within the request); updating legacy systems to talk to new URLs (possibly multiple URLs, to support multiple versions) because an API has changed is not an option, and the framework has been designed to operate within the constraints of the current web services that offer e-commerce.

      --
      i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
  69. Re:once burned... by renoX · · Score: 2

    > The K&R C to ANSI C transition broke many of my programs

    Uh? Many compilers had a switch which allows you to stay in compatibility mode in K&R.
    -> No need to modify the programs.

    As for the C++, there are some compatibility modes but I'm not surprise that you still had to make modifications: this language is really messy.

  70. Re:Microsoft can do it... by Anonymous+Brave+Guy · · Score: 2
    Next, C# *is* brand new, but C++ still exists. I can't speak to compatibility between C++ in .Net vs. the previous version, but I suspect that, like VB, C++ remains largely intact.

    C++ is not a Microsoft product, and hasn't changed a bit with the release of Visual Studio.NET. Microsoft's implementation of same, which they now called "unmanaged C++", also hasn't much changed (but can't use most of the useful bits of .NET, either). Microsoft's .NET-friendly version, "managed C++", is just another syntax for the C#/VB.NET combined entity, with all the same limitations (no generics, MI, etc).

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  71. Re:If Java were truly open by Perdo · · Score: 2

    Think Linus: All the unices were unfree or could be incorperated into unfree products without giving anything back to the community. Linux created his own unix kernal from scratch and distributed it under the GPL.

    Microsoft created a Java work alike in C#. Someone will eventually create a Java worK alike and GPL it.

    --

    If voting were effective, it would be illegal by now.

  72. Further details. by Inoshiro · · Score: 2

    A special syntax since it acts very much like a structure. And, as the Sun docs state, "Arrays are supported directly by the Java programming language; there is no array class. Arrays are implicit extensions of the Object class, so you can assign an array to a variable whose type is declared as Object." There is no class to implement the length member like the original poster wanted. Implicit isn't quite the same as is, IMO.

    "Not messing around with "dirty details" is one of the goals of almost every language."

    One of the goals, yes, but that doesn't mean you don't sit down and work with them somewhere. Smart programmers abstract it away, as I suggested to the original poster who stated that he hates mucking about with the primitive types. Based on how he was complaining about it, I don't think my suggestion that he abstract it away was at all off base.

    --
    --
    Internet Explorer (n): Another bug -- that is, a feature that can't be turned off -- in Windows.
  73. Hey, I never thought of it that way before. by Inoshiro · · Score: 2

    I guess I was bashing a square peg into a round hole :) Using templates around hetergenous data structures makes a lot more sense than what I thought they were for.

    --
    --
    Internet Explorer (n): Another bug -- that is, a feature that can't be turned off -- in Windows.
  74. Some old myths surfacing here again by Anonymous+Brave+Guy · · Score: 3, Insightful
    Multiple inheritance has major problems (if both superclasses have the same function, which one do you use?).

    Multiple inheritance of implementation has absolutely no major problems. If you have a conflict in a derived class, you can simply rename one or both functions in its interface. When your object is used as a base class object, it advertises the base class interface, and when it's used as a derived object, it advertises the derived interface, with the renamed features. If your derived version wants to provide an override of either or both base classes' implementation, you can always do so. None of this violates the Liskov Substitution Principle, or any other OO design rules. The only reason languages don't support MI is because it would break their object model or something that depends on it, not because of any theoretical flaw with MI itself.

    I agree, often MI is not the right answer to a design problem. But when it is, it is. If your type genuinely can be interpreted as more than one base type and behave as such, multiple inheritance is the correct relationship to model that.

    The usual arguement against [overloaded operators], that it's very easy to change the semantic meaning of an operator and this can confuse developers, is just as applicable to an "add" method, but I don't think it's a devastating loss to the language.

    Indeed. The arguments against operator overloading are bizarre to say the least. "We don't like artificial operators!" they say, as they concatenate their strings using the + operator, while writing z1.addTo(z2) to add two complex numbers.

    Added to which, as I've argued here before, operator overloading is a very important complement to writing generic algorithms. If I want to write a generic summation algorithm that can add the elements of an array of any type, is it more sensible for me to write it using the natural + notation and provide the ability for complex numbers, rational numbers, fixed point numbers and such to implement that operator, or is it smarter for me to hope that everyone gives their classes a method called add, and not addTo, sum, increase, or bananaMilkShake?

    I agree entirely about the low-level features (hide them, don't make them part of a language like Java) and templates. Templates is a particularly glaring omission, and even the proposed generics aren't really up to the job of basic generic programming AFAICS. C++ IOStreams may suck because they gave every method a stupidly obscure name and no-one understands them, but compared to Java's "five lines of bizarre OO to read a string from the keyboard" approach, it's a godsend. A little generality would probably go a long way here, aside from improving things like the container class situation.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  75. Productivity by Anonymous+Brave+Guy · · Score: 2

    Productivity always depends on the developer's preferences. Personally, I don't miss GC at all when I'm programming in C++, but I find it crippling to lose basics like enumerations and templates in Java. I'm quite happy with a language that doesn't hold my hand, because I adopt programming practices that mean my gun isn't loaded so I can't accidentally fire it. YMMV, of course; that's why there are so many languages in wide use.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  76. Two questions by sacrilicious · · Score: 2
    Two things that surprised me, and for which I'd welcome any information anyone can contribute:
    [data written to a well-implemented XML] format should be both smaller and faster than today's binary serialization
    How could the XML version of something be smaller than the binary? On the "smaller" angle, a four-byte float can easily become a 12-byte string. On the "faster" angle, no conversion back and forth beats a conversion both directions. How is his claim possible?
    Both the new and old I/O APIs still assume that the complete contents of a file can be accessed as a stream (true on Windows and Unix but false on the Mac).
    What is false about the supposition that a Mac file can be accessed in its entirety as a stream?

    .

    --
    - First they ignore you, then they laugh at you, then ???, then profit.
  77. agree with cleanup, disagree with everything els by bolthole · · Score: 2

    I think it would be a great idea to "clean up" java.

    However, I disagree with almost every single idea the guy has about 'clean'.

    Basic types like 'int', should STAY in.

    Char should stay at 2 bytes. strings are bloated enough already, and we dont need explicit klingon support :-)

    XML is a bloated pig. I thought the object was to REDUCE bloat, not increase it. So converting configs to XML makes no sense as 'cleanup'

    and lots of other things that I'm wondering what the heck went through his head.

  78. Primitive-Object duality a pain by Bodrius · · Score: 2

    But it doesn't mean merging is necessary, or a good idea at all.

    C# solved the "boxing" and "unboxing" problem its own way, and I guess that's what inspired the author to propose the merge, but I don't think that's the simpler, best solution for the language.

    It is my inexperienced opinion that he pointed something better (from the point of view of a programmer that wants to know when he's dealing with primitives or with an object) when he said it wouldn't be much more complicated than the + operator for String:

    - Why not "overload" the arithmetic operators for the container classes?

    This would be part of the merging process, but it would be 95% of what's really needed, and I'm still trying to figure out why they did it for String and not for Integer.

    I can still now that "int a" will be forever an int primitive, and "Integer b" will forever be an Integer object, and will still get a compiler error if I mix them up... but "a + b" will give me sensible results.

    The other 5% of the "need" for merging comes from Collections and their use of Object. But I still don't see why this should force us to turn everything into Objects.

    Why not solve this with convenience methods in AbstractCollection and/or static methods in the Collection/Array classes?

    Static methods would probably imply less work and be a bit more consistent. Static methods for adding large arrays of primitives (and retrieving them) from a Collection solve many of the Object/dichotomy problems.

    The problem is that a method for adding/retrieving individual elements does not "belong" there. Collections.addInt(Collection c, int a) would do the work but reads a bit awkward.

    Since most of the trivial common work for a Collection is already on the AbstractCollection, having some primitive-oriented "get" methods (like in JDBC) would be feasible and perhaps sensible.

    My main gripe with this would be that I'm not sure this should be a change in the Collection interface, so as to not make it annoying to implement from scratch. But probably it should.

    --
    Freedom is the freedom to say 2+2=4, everything else follows...
  79. Casting by Anonymous+Brave+Guy · · Score: 2
    But casting is a necessary feature: I'm sure that, as much as you hate it, every so often you've been forced to do a dynamic_cast, because it's the only reasonable solution.

    There is absolutely nothing wrong with using RTTI, including dynamic_cast, where it's appropriate. The issue is that while dynamic_cast is actually a very clean feature since it has a built-in test for whether the cast makes sense, other casts (particularly reinterpret_cast, if you like C++ terminology) coerce data in an unnatural way, and that is a recipe for bug soup.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  80. IBM's Persistent Reusable JVM and security by Nick+Mitchell · · Score: 2, Informative
    Check this out, dudes: The 390 Persistent Resuable JVM

    The 390 machines use this not for performance, but actually for security. Each transaction uses a fresh JVM heap, so there is no possibility that errant code might mistakenly (who, me? hehe) read something is shouldn't, like the previous transaction's cleartext user info.

    nick (i believe this post is past the SAT, the Slashdot Attention Threshold, hehe, lesse if anyone reads it)
  81. Re:This is all academic by jbolden · · Score: 2, Informative

    Microsoft's browser support running the JVM of your choice. I've been running Sun's on I.E. for years now. You do the same things with your Java apps that sites did for years when they posted Acrobat "to use this site you'll need...".

  82. Re:not if he wants everything to be an object by Ayende+Rahien · · Score: 2

    Floats are easy.
    You can only have one period in a floating point number, so you consider every number with a period in it as a double, and treats the second period as a serperator.
    The following compiles perfectly on C#:
    5.5f.ToString();//Float to string
    5.5.ToString();//Doublt to string

    As for the reverse, it's not String's place to have convertors in its interfaces.
    Each and every type should supply its own.
    On C#, it's as easy as:
    int a = Int.Parse(some_string);

    --

    --
    Two witches watched two watches.
    Which witch watched which watch?
  83. Re:hmmm by Twylite · · Score: 2

    Java has no assembler level instructions to do port IO. It also doesn't provide you with direct memory access - which goes beyond alloc/free as you need to control the descriptor tables which define memory protection. Then you have the problem of handling interrupts (not only hooking them, but masking and unmasking, which on most architectures as CPU instructions), etc.

    Without JNI, you can't hope to achieve any of this. C/C++ allows you to "drop down" to asm at any point, in such a way that the asm is compiled into the final object code. Java has no such functionality.

    It *may* be theoretically possible to create a Java kernel on a system built specifically for that purpose - by allowing hardware control (IO, memory protection, interrupts) via memory mapping; but I still think you'll find you need to run a microcode interpretter on the CPU to handle garbage collection (amongst others), and a class to provide direct memory access to the mapped regions -- neither of which could be expressed in "pure" Java.

    --
    i-name =twylite [http://public.xdi.org/=twylite], see idcommons.net
  84. No need to remove functionality, just deprecate by Sanity · · Score: 3, Insightful
    In the article, I didn't see a convincing argument why any of these changes require that backwards compatability be broken, that is the whole point of deprecation.

    If the price of not pissing off the current user-base is to support some deprecated functionality, then I really think that the good outweighs the lack of asthetic simplicity of not having deprecated methods.

  85. Sorry, but he author has not much clue .... by angel'o'sphere · · Score: 2

    1) XML and serialization
    Why should the serialization format be XML?
    Well, he is the author of "XML in a Nutshell", thats why.

    When I serialize an object I only open a file and use an formatter(ObjectOutputWriter) to write an object into that file.

    When I deserialize an object I open a file and use an ObjectInputReader to read it back.

    I simply have no touch to the file format, nor do I care about the file format and even if it was carved in stone, I would not care. There is absolutely no reason to change the serialization format.

    2) Class loading
    No single topic is as confusing to new users as the class path. I get almost daily e-mail from novice readers asking me to explain the "Exception in thread 'main' java.lang.NoClassDefFoundError: HelloWorld"

    What is so complicated in understanding how a path varibale works? All shells use PATH, even DOS use a varibale called: PATH ....

    The CLASSPATH works exactly the same. If a so called programmer does not understand the fundamentals how a computer, a OS, a shell, a program and finaly a language is working .... he is not a programmer.

    Read some books, learn something ... yes, ask questions. But do not claim the classpath is wrong ... you expect a newbie to read a XML config file where pathes are configured? A classpath variable is definitly much easyer to get!

    3) Ditch AWT for Java 3
    Oh my godness ... why?
    No one uses it. Why to ditch it and rework the stuff relying on it? Sure its somewhat obsolet ... but thats not a reason to ditch stuff.

    4) Fix threads

    A self called non thread expert says that. Yo ... well ... probably they should be fixed.

    However I like them. I never did thread programming before I used Java ... and the problem with threads is not having a suspend() or a resume() method. The problem is designing an application multithread save or better multithread friendly. Thats not a problem off some methods or not, its a problem of education for the developers.

    5. Eliminate primitive data types.

    It definitly makes sence to automaticaly wrap ints and doubles etc. into their appropriated object type when needed.

    But the claim a compiler allways can deside wether a "1" should be treated as an object or as a primitive type is wrong. A compiler can that only do with a gloable view on the class it is compiling, and not localy on a method base. Further more: this is only suitable for a class view. The gloabl view over all classes is not possible in java. Its far to easy to get a object of an unknown type via RMI into the JVM wich treats an int just in the opposite way ... so you rely on runtime optimization.

    The solution (short sighted from my side) is to allways use objects and to rely on JIT compilation and HOTSPOT optimization.

    However .... there is a basic difference in concepts between primitive types and objects.

    Objects have an identity.

    "1" and "1" are two different objects.
    1 and 1 are .... no one knows ... its a philosophical question wether they are IDENTICAL or only the same valus (do they reffer to the one and only 1 in the universe?)

    Its a hughe difference if you pass a 1 in a method call or an object which can be used as a 1.

    Call by value versus call by reference ... const and not const, identity versus equalness ... that all is to question.

    Yes, you can say: I like to have all numerical values to be objects(arg .. not values). But then you have a different kind of language.

    Its far, far more important to include contracts on a language level (not only an assert keyword), templates and probably even range checkled pointers(I dissagree here but James Coplien is in favour for them) and probably even to include more
    higher levle OO concepts directly into teh language. Like composition, mixins or even support for declarative design patterns.

    angel'o'sphere

    P.S. I use for all things I need property files ... never needed XML.

    --
    Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
    1. Re:Sorry, but he author has not much clue .... by angel'o'sphere · · Score: 2


      It should be wise to consider that Java wants to be a big player in the web services field, and just for that reason, it is imperative that the file and serialization formats in any program should be the same as when you're passing web service messages to and fro. And why do you care if the serialization of an object is binary or xml? You're still just calling a method, and as you say, don't care what the actual format is, right?


      I disagree. For that externalization is used. Also XML serialization may exist side by side with standard serialization.

      SOAP and other XML messaging standards go far beyond simple method calls, and therefor have an overhead and a whole infrastructure associated.

      My point is not against XML, my point is against the authors argumentation!

      In C# (essentially java, in the end), it doesn't matter whether you declared a string or a String. You need the
      functionality of the later, the compiler is clever enough to know how to swap types. You wouldn't believe the ease
      that it gives you. You just don't think about it.
      I fully support this, and I thought I made that clear.

      However again: the authors argumentation is wrong. The compiler can't allways make this desccision.

      Yes, the compiler can descide localy and swap types, but this usualy means that copies get created. And that changes the semantics. Often this changes nothing bottom line. But there is a difference. And: the author claimed a compiler allways could descide ... and thats wrong.

      My conclusion was: there are far more important things to consider if you like to refactor a language. That was the authors goal, but he mainly refactores the infrastructure and the libraries .... thats not what I call a language. And he did it IMHO poorly.

      angel'o'sphere

      --
      Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
  86. Why experienced guys do better with C++ by Anonymous+Brave+Guy · · Score: 2
    I'd be quite surprised if C++ programmers would ever _overtake_ Java programmers in productivity. The biggest difference between the two languages is that Java manages some things for you (garbage collection, etc).

    I completely disagree. GC is a helpful tool in some circumstances, but no more than that. It doesn't revolutionise programming, or cause some magic shift in coding style. It's just a tool, and only one tool in a very full toolbox.

    How often do you think I actually write a manual delete in my C++ code? (Hint: I haven't written it more than once or twice in over a month, though I've refactored and extended about 2,000 lines of code in that time. I think I might have used new half a dozen times, though.)

    I don't buy the the argument: "I have experience, so my programs don't have those bugs."

    Why not? It is basic programming technique in C++ to write in such a way that you don't have resource leaks. (NB: That's all resources, not just memory -- a big advantage over Java's GC approach, which only guarantees any protection against memory leaks.) The fact that probably 90% of C++ programmers don't do it doesn't mean it can't be done. This is where the experience tells.

    I have several years of programming in C++, and hundreds of runs of PC-Lint, Purify and other similar tools, to support me on this. I don't think we write code without leaks, I know it for a fact, because I have magic tools that shout at me if I screw up.

    I have never met a programmer with sufficient experience to write large, complicated programs that are correct on the first try. Garbage collection eliminates an entire class of bugs automatically.

    So does correct programming technique. Why do people not understand that GC is almost irrelevant to C++'s memory/allocation model? You use basics like automatic variables, references, smart pointers, container classes and the RAII idiom, and that class of bugs just vanishes in C++, too. C++ programs simply do not need to be vulnerable to resource leaks, buffer overruns, etc. It's not rocket science, it requires reading and understanding one good book. As I said, the fact that probably 90% of C++ programmers haven't bothered to read that book doesn't make it wrong, it just makes them lazy. The other 10% of us routinely write code with no resource leaks.

    And yes, it is true that when writing low level code, probably for a library, you would want to put diagnostics in to catch logic errors. It's also true that this costs a modest amount of development time. But then, you'd do that in Java, too. (You do put in checks that your class invariants aren't violated and so on, right?) Compared to the cost of prolonged debugging exercises, and given the tiny fraction of overall development time that is spent adding these diagnostics, the effect on developer productivity barely even registers on the scale.

    Quality is free, or pays you back with interest. C++ provides the tools to write very robust code -- and far more of them than Java, at present -- and the more experienced the developer, the better able they are to take advantage of those tools. It's really as simple as that.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  87. Re:not if he wants everything to be an object by miniver · · Score: 2
    >>On C#, it's as easy as:
    int a = Int.Parse(some_string);

    In Java its pretty easy too:
    int a = new Integer(some_string).intValue();

    Under Java it's even easier that that:

    int a = Integer.parseInt( some_string );

    Just remember to catch the NumberFormatException.

    FWIW, String isn't the right place to do data conversion -- you'll have to change the String class everytime you want to add another data conversion for another type. Java already does this the way it should (and so does C#). Sure, the code isn't as 'pretty' that way, but you keep the information where it's supposed to be: with the data class, not with a representational storage class.

    --
    We call it art because we have names for the things we understand.
  88. Re:not if he wants everything to be an object by miniver · · Score: 2
    Not easier but rather just another way to do make the same Mouse trap. If we go by code size as being "easier" using parseInt requires a try/catch block being implemented since it throws a NumberFormatException. Both are used in different situations.

    The difference is this: do you want to create an object and throw it away, or not? Your way creates a new object and then immediately throws it away; my way doesn't. That's a pretty expensive operation ... much more expensive than try/catch. If you want to parse numbers from strings without having to worry about catching exceptions, write a static method in a utility class.

    >>but you keep the information where it's supposed to be: with the data class, not with a representational storage class.

    I do not understand your terminology. Please give a definition of what you call "data" classes and "storage" classes.

    String has been overloaded as a class: it serves two purposes. The first is to store strings, and the second is to store string representations of other types of data (numbers, XML, whatever). When used in the first sense, it's a data class; when used in the second sense it's a representational storage class - it's storing a representation of the data, not a directly useable instance of the data. It's the difference between 5+4 (9) and "5" + "5" (55).

    My point was that the String class should know how to manipulate strings, but it shouldn't know about manipulating numbers stored in string format.

    --
    We call it art because we have names for the things we understand.
  89. Re:not if he wants everything to be an object by Ayende+Rahien · · Score: 2

    > String.valueOf(5.5f);
    >What interfaces? String already has valueOf() functions for all primitive types.

    That is bad coding practice. It's nice and easy, but it's not good to do so.
    The reasoning? Simple.
    Why you have String.valueOf(Int) and not String.valueOf(SomeCustomClass) ?
    Using this method puts the responability for translating the object to string representation in the hands of the String class. It should be the responsability of the objects to supply it.
    String.valueOf() shouldn't exist.
    Or should exist in this form:
    string string.valueOf(object Obj)
    {
    return Obj.ToString();
    }
    The above won't work on Java, because of the primitive system it uses, but it would work just fine on .NET/C#.
    You are going to argue that this is (probably) possible in Java, with one method for object, and overloads for all the primitive types.
    The problem here is when you want to add a new primitive type, say Complex.
    You *can't* do that without adding a new method to String, and to any other class that wants to be able to handle all types in Java.

    > If my String idea was used you could write it:
    > int a = some_string.intValue();

    This is even worse, mind you.
    There is no justification for such an abomination in the interface.
    This has *no* place here, it should be, as it is, in the Integer class.

    --

    --
    Two witches watched two watches.
    Which witch watched which watch?
  90. Yes, we do by Anonymous+Brave+Guy · · Score: 2

    Right now, there are glaring problems with just about every language in existence. Mostly, they fail to combine both power in the underlying programming model and a clean and safe syntax to use that model. Thinking about all the languages I know, pretty much every one could be vastly improved in at least one such basic area.

    OTOH, some languages Get Things Right(TM) spectacularly in a particular area. Perl's regular expression handling provides a powerful implementation of a widely useful feature in a pretty straightforward way. Pattern matching and enumerated types in ML provide an elegant solution to many common situations that would require reams of polymorphic twaddle in most languages. The sort of power and clarity exemplified here should be the standard, not the exception.

    Programmers today are sufficiently familiar with the basics of common paradigms and idioms that they don't need to be held back by old syntax any more (hint for C# there!), nor should each iteration of a language forever be held back by the mistakes of its earlier incarnations (hint for Java 3 there!). Old code obviously needs to run, but then that should be run against a suitable compiler/JVM/whatever. Holding new development back for compatibility's sake is exactly the reason so many languages today are just syntactic sugar for the same weak underlying models.

    --
    If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
  91. C++ is portable by yerricde · · Score: 2

    C++ (which I also program) isn't exactly portable.

    C++ is portable. However, C++ does not specify a GUI layer.

    You can use a GUI toolkit such as Qt, GTK+, or the one Netscape Communications developed for the Mozilla project. Any one of those will work on BSD, Linux, UNIX®, Mac OS X, and Windows systems, covering (100-epsilon) percent of workstations in home and business environments.

    That is, unless you're talking about running on multiple embedded systems, with completely different video architectures, some of which run slower than 20 MHz and have less than 512 KB of RAM.

    --
    Will I retire or break 10K?
  92. Fixed platforms and changing laws by yerricde · · Score: 2

    The biggest difference between the two languages is that Java manages some things for you (garbage collection, etc).

    Thus forcing you to wait 18 months for hardware to catch up if you're writing a soft-real-time application such as a video game or a media player. And on some fixed platforms such as game consoles, you have to wait five years for the next platform.

    Even worse, with the current legal climate in the United States of America, if you don't get your program out NOW, you may never be able to release it because the government might ban it as a terrorist tool, or Microsoft might refuse to sign it for use on Palladium PCs because it competes with a package Microsoft sells.

    --
    Will I retire or break 10K?