Discussions

News: Cameron Purdy at TSSJS 2010: If Java beats C++, what's next?

  1.  

    Oracle's Cameron Purdy took a look back at Java and C++ in a presentation Thursday at TheServerSide Java Symposium in Las Vegas. He marked Java as a significant step forward from C++ and continued, suggesting that the Java language was in a good position to thrive in years to come as grid- and cloud-oriented distributed architectures find greater use.

    In Purdy's view, certain aspects of C++ proved a drawback in development in a technology world that has come to be dominated by Web browsers.  He treaded not too softly on C++ in his often humorous monologue.

    Why did Java succeed?

    Java was able to effectively supplant C++ because of advantages it gained in terms of build and source code simplicity, dynamic linking, a standard type system, portability and garbage collection, said Purdy, who serves as vice president of development for Oracle. Prior to that, he was founder of Tangosol Inc., maker of an in-memory data grid. Tangosol was purchased by Oracle in 2006.

    ''The explosion of the frameworks we have in Java is a direct result of its garbage collection ability,'' he said. ''It gave us the ability to plug things together without explicit contracts. ''

    No surprise there. Garbage collection is pretty much accepted as a big plus for Java versus C++. He went on to strings.

    A standard type system helped Java thrive while it is still debated in C++, he said. A portion of the dedicated C++ community ''is still arguing about 'what is a string, ' in Purdy's estimation.

    ''There is nothing standardized there. A string could be 16-, 32-, 64-, even 80-bits, '' he remarked, citing a rare 80-bit format attributed to the Intel 80387 coprocessor. ''It seems like a minor detail, but out of the box with Java you can assume this stuff is there, '' he said.

    Purdy pointed to other C++ elements upon which the upstart Java improved. These were safety, reflection, and performance. Many people would argue this last point. Here is Purdy's rationale.

    ''It turns out that Java performance is much better on modern architecture. That is because of multicore processors and in-lining,'' he said. Many benefits here result from an ever improving Java Virtual Machine. But your mileage may vary - the skill of the programmer is naturally still a factor.

    ''If you have all the time in the world you can build it to run faster in C++, or assembly, '' he admitted.

    In fact, Purdy did not try to position C++ as a total laggard - he admitted that there were places where C++ still excelled. Examples he gave are boot up time , memory footprint, and deterministic destruction.  Garbage collection pauses of Java can still stymie some applications, too. His argument was that the places where Java excelled made it more appropriate in the networked world of the Web.

    But some advantages C++ had, in Purdy's somewhat jaundiced take, largely went away with the advent of the Web as an all-purpose platform. In Web applications where start up time matters, Python and PHP have found a role, not C++, he said

    The Tangosol founder noted that the original HTML browsers were written in C and C++, but, once that was done, the field - ''the area where we build something'' - was open for Java. ''I am not going to download C++ apps to execute in the browser, '' he said, adding that ''shift happens.''

    Looking ahead at JDK 7

    In looking at future distributed computing as it is being portrayed by virtualized cloud computing advocates, Purdy sees a continuing role for an evolving Java. Purdy said that traits that can improve Java in distributed environments are being added to the now-brewing JDK7 tool set.

    ''In JDK 7 you are already seeing work on modularization. The Java NIO.2 File System in JDK 7 includes pluggable file systems. Why is this cool? A pluggable file system means the file system is no longer the OS file system. It's whatever you make it.''

    This means: ''You can create a virtualized file system that is shared across an entire environment. So you are providing access to an application in a way it can be used easily. ''

    ''You can take existing code that is expecting to read and write to a hard drive and use it in an environment that is completely virtual, spread out across multiple machines.''

    Purdy looked to find lessons from programming history. ''Learning from the past, a language is either fit for purpose or it has to change to become fit for purpose. If you look at C++ it just wasn't able to make that jump.''

  2. This means: ''You can create a virtualized file system that is shared across an entire environment. So you are providing access to an application in a way it can be used easily. ''

    FUSE called from 2003. They want their filesystems back. In reality, I used a VFS in Java back in 1999, even with hooks for standard library classes. Considering that filesystem API in Java is still quite poor that was not a big deal.

    Also, app-level VFSes are not a big deal in general.

    The Tangosol founder noted that the original HTML browsers were written in C and C++, but, once that was done, the field - ''the area where we build something'' - was open for Java. ''I am not going to download C++ apps to execute in the browser, '' he said, adding that ''shift happens.''
    Oh, but you do. You probably have Flash plugin in your browser, right? Why do you think we're using Flash and not Java applets?

    Answer: startup time and performance!  And then there's also Google's http://code.google.com/p/nativeclient/

    Asking why C++ has not conquered web-apps is kinda silly. C++ is a complex and demanding language. Why would you want to use it for large apps if it's easier and cheaper to just install a couple [dozen] more servers? You can't do this with end user computers, so C++ is still strong there.
  3. Oh, but you do. You probably have Flash plugin in your browser, right? Why do you think we're using Flash and not Java applets?
    I would say it has a lot to do with the Microsoft JVM effectively trapping Applets in Java 1.1 (for those who are too young or don't recall, that was a horrible place to be.)  In addition, there were a number of missteps on Sun's part such as a lack of modularization in the JDK which is the root cause of slow VM startup time.
  4. I would say it has a lot to do with the Microsoft JVM effectively trapping Applets in Java 1.1 (for those who are too young or don't recall, that was a horrible place to be.)  In addition, there were a number of missteps on Sun's part such as a lack of modularization in the JDK which is the root cause of slow VM startup time.
    Partially. Though most of blame lays on Sun - they were not able to write a good GUI framework for lightweight applications.

    Things like animation and visual effects  are still quite difficult in SWING.
  5. Too little too late[ Go to top ]


    SUN did write a good GUI framework for lightweight applications - JavaFX. the problem was that it never picked up. Partly because Flash/Flex was already popular but I think the biggest problem was that the end user needed to download and install the entire JRE just to run a JavaFX app. To that you can add the lack of a good WYSIWYG GUI editor (like Adobe Flex Builder) and the technology pretty much failed.
  6. Partially. Though most of blame lays on Sun - they were not able to write a good GUI framework for lightweight applications.

    Things like animation and visual effects  are still quite difficult in SWING.
    While Swing has a lot of issues and Sun left it hanging out to dry for way too long, I think it's a bit misunderstood.  Swing is designed for highly dynamic interfaces.  That is, the when what controls are added and the layout is done at runtime.  But most people weren't trying to do that with Java.  They just want a basic static interface.  What was needed was a DSL over the Swing APIs for most uses.  Unfortunately, that ideas was very much out-of-vogue at the time Swing was in it's opportunity phase.  Now there's probably no improvement that can save it.
  7. What doomed swing[ Go to top ]

    What doomed Swing was the initial attitude of Sun. Their thought was "GUI?? What GUI??? Real Programmers use command line and VI to code and they shouldn't complain about the lack of a good UI toolkit to develop Swing/AWT code."
    (At the risk of starting a flame...)While Microsoft has a lot of issues, what they did very effectively was provide an excellent IDE for their developers. Developer productivity has been at the heart of Microsoft and Adobe's product suite. While Java being "open", there seemed to be no single vendor willing to take up as a priority tooling for developers.

    Today Eclipse and Netbeans are comparable, but too late in the game for Swing.
  8. They already had a great framework for lightweight GUI applications.  Unfortunately, it was Not Invented Here so they chose to throw it out and start over again:

    http://www.noodlesoft.com/blog/2007/01/23/the-sun-also-sets/
  9. Thank you, this was interesting. It makes me think about the days were I was a C++ coder. I tell you I do not miss anything. As a developer, Java is a pleasure to write code in compared to C++.

    Cheers,

    Emiliano Conde
    Lead Developer
    jBilling.com - Open Source Billing
  10. C++ had its place[ Go to top ]

    Certain core applications / frameworks like WebSphere MQ will continue to be C++ apps for performance reasons. But have to accept Java Beats C++ in application development - especially on server side.

    <!--Session data-->
  11. Performance Numbers[ Go to top ]

    Relevant performance numbers here...
  12. has someone posted the code on c++ forum[ Go to top ]

    Has someone posted the c++ code on c++ forum for review. Most Java developers write terrible c++ code.

    To be clear, I am java developer and have working knowledge of c++. I have seen one too many performance comparison in different language. Few months ago, someone compared ruby and python code to show performance increase of ruby compared to python. Looking at python code, it was clear that the writer was python novice.


  13. c++ code[ Go to top ]

    Has someone posted the c++ code on c++ forum for review. Most Java developers write terrible c++ code.

    When we benchmarked C++, we included implementations from Boost, and also built with early prototypes of C++0x smart pointers, etc., in addition to our own C++ implementation (with inline assembly to take advantage of new x86 capabilities like CAS). Java's thread safety with multiple threads and cores is far "cheaper" than C++'s, because the JVM can make specific determination at runtime of what "smart pointers" to optimize out.

    Peace,

    Cameron Purdy | Oracle Coherence
    http://coherence.oracle.com/
  14. I tinkered with C++ in DOS before the first Win version.

    Recently Java with the open source NASA WorldWind.

    Python was and is the easiest to program in.
    I have been porting several small apps from Java to C++, it is faster and in many cases more control and power.  It just feels right when run.  No JVM required.  Win C++ apps can usually be run in Linux with Wine or just compiled in Linux.

    A few cons with Java:
    Serial port support of comm was dropped, need to use rxtx.
    Limited heap space.
    Heavy weight v light weight conflicts for graphics.

    With U++ (Ultimate++) C++ is easier to program with than Java in many instances.  Eclipse is a good IDE for Java, NetBeans was a pain.

    Java apps can be easily be decompiled with jad, no protection.