Why I think Java will take the lead over C++

Discussion in 'Programming' started by wavetrader007, Dec 6, 2011.

  1. With a background primarily in software engineering and living in Java I just don't see a strong future for C++ as the primary language for developing trading systems. The argument a few years ago held true that performance was faster with native code which C++ compiles into but if you look at the industry and where Java is headed here are my major points for seeing this shift: This also holds true I think with Java vs. Microsoft.NET

    1. The huge amount of open source frameworks built in Java that are available for free when building systems is incredible. This ranges from generic to trading specific frameworks like FIX integration. So you get a head start and faster development time in Java vs. C++

    2. Java performance keeps getting better its easier to code in java, it abstracts memory management from the user which is a big advantage in not having to deal with memory leaks. If you compare raw computing between java and C++ it’s very minimal. Its also easier to maintain and understand existing code in Java than C++.

    3. The tooling for java and the tooling that can be built for domain specific languages for building trading strategies are feasible (which is what I have done) in java and you can even embed other higher level languages on the java platform unlike C++.

    4. It’s easier to build distributed systems with java using higher level networking frameworks and with the ability to build distributed systems like I do for tick processing that would take a long time to build in C++. I can process over 70 million trades per session using multiple servers all in real time with java.

    5. Look at the developer market, you have more developers that are really good in Java than C++ and I think the old school thought that trading systems should be built in C++ is going to fade. The one exception might be ultra ultra low latency order execution but we are talking less than milliseconds of difference and in my experience people building systems the order submission time assuming you’re in a good data center is extremely fast with the brokers I have experience with.

    Just my two cents would be interested if people agree or disagree. - WaveTrader007
  2. vikana

    vikana Moderator

    I think you are right, and I reached the same conclusion about 10 years ago when I recoded my framework from C++ to Java.
  3. Occam


    For (1), I would say the opposite is true. In my experience, C/C++ has far more libraries, and of greater maturity, than does Java, at least for the types of things that algorithmic traders tend to do; e.g., math-heavy computation.

    (2) I would largely agree with, although there's a lot of application dependency.

    (3) I don't see why you can't do so in C++, although it would likely be uglier at some level.

    (4) Sometimes higher level is good, and sometimes it isn't, but I do like the Java multithreading stuff more, in general.

    It seems people have been predicting the death of C++ for years, but as ugly as it can be, it still appears to dominate in many areas, e.g. large-scale algorithmic trading.

    If anything, my guess is that something completely new will come along and overtake C++, e.g. some functional-ish language like Scala, which might deal better with the slowdown of increase in single processor speed. That said, the existing functional languages are starting to look less likely, as they also have now been predicted (for years, even on ET) as replacements for C++ in trading. But there's always something new on the horizon; eventually something new will take over, as C++ itself did in the 80's.
  4. Mr_You


    Assuming Oracle doesn't screw it up! :p

    I've avoided "heavy weight" application development, but from my observations it seems to me the winning languages will be those that can enable developers to easily take advantage of multi-core CPUs and integrate multiple language paradigms (OOP + Functional).

    For example:

    Java + Scala
    C# + F#
  5. Has anybody tried writing JVM in Java?
  6. I think microsoft realized the basic gist of your discussion, and therefore implemented .NET framework into their languages. I've been reading and hearing C#.NET is actually what will become the front running language in the C family
  7. Good point on Microsoft. But the major difference Java is free and all these oepn source frameworks are built in Java how does Microsoft compete against that?
  8. vicirek


    Hard to admit but .NET is becoming real challenge for all others on IDE side and available resources and most importantly program performance.

    It looks like C# will finally succeed as main programming language for Windows platform.

    The only problem is that many programmers were burnt in the past by staying loyal with Microsoft. However, Microsoft is no longer monopoly as it was before and they are more programmer friendly and really good - they still know some things about Wintel hardware/windows that others do not and that gives them an advantage.

    For non windows based applications it will have to be Java; or C\C++ for those procedural programmers who have good understanding of inner workings of hardware/operating systems and can use Object oriented features simplifying complex appliication building or want to branch into GPU programming etc.
  9. schemer


    In my opinion, too much importance is given to the programming language. Granted, some languages are more concise, expressive, faster, slower, functional, imperative, better at concurrency, better at mathematics, better at scripting, better for large systems, etc...

    I think what matters is that you choose the appropriate language for the problem at hand. Comparing Java vs. C++ vs. C# is not really much of a comparison, as they are very much the same. Yeah, you can argue, that C# has nicer syntax for anonymous functions, has Linq, or whatever. C++ has powerful Templates, maybe compiles to faster code., etc.. Java has 10 different libraries for anything you could every need, etc...

    But at the end of the day, I think it comes down to what the developers feel comfortable with, what fits into the culture of the development environment (e.g. the organization or whatever).

    Personally, in my day job, I program in mostly C#. In my personal side projects, I use whatever I feel like, mostly Clojure at the moment. Is one better than the other. No. Each language has its strengths and weaknesses.

    Use whatever allows you to solve problems.
  10. cookding


    To say Java's garbage collection will do away memory leaks - is a fairy tale. I have seen other people's Java GUI code with serious memory leaks due to losing track of some object references unknowingly kept within the Java framework. The programmer thought he does not have anything referencing the memory but at some point the GUI framework was referencing the block of memory (he sent the reference down) and that reference was not severed.

    If my memory serves me right... I have not done Java programming for a long long time - another simple (theoretical) example would be circular referencing to a block of memory - I think the memory will never be freed since reference count to the object is not zero.

    However C++ is a much harder language to get good at which takes experience.
    #10     Dec 10, 2011