Channels ▼

Eric Bruno

Dr. Dobb's Bloggers

Java and C++

March 21, 2011

I recently wrote about how IBM's Watson, which beat its human competitors on the game show Jeopardy, was written mostly in Java. Some of it was written C++, which led to an interesting, passive-aggressive comment that C++ must have been used for the critical pieces. I object to that.

While I focus mainly on Java these days, I have deep respect for both languages. I was a C/C++ developer for a long time before I moved to Java, and it helped make me a better developer. But Java has treated me just as well in subsequent years, so here we are.

Having been on both sides of the fence, I can say that neither C++ nor Java are better suited than the other for writing critical software. This I say with experience, both personal and through the hundreds of clients I've had the opportunity to work with over the years. I can say without a doubt Java is being used to solve some of the toughest software problems in the world, handling trillions of dollars in transactions per day with predictable and low latency, managing power systems, critical medical equipment, space monitoring systems, the list goes on. So is C++.

Performance? Don't go there. With today's JIT compilers, Java code gets compiled to machine code just as C++ does, albeit at runtime. However, this leads to Java's advantage at times, since it can also be optimized and reoptimized while an application runs, self-tuning itself in ways statically compiled applications cannot.

Latency? Real-time Java brings it in line with C++ applications. I would argue that writing low-latency code is more a factor of programmer knowledge and skill than it is the language chosen. Garbage collection? Now you're dating yourself because so much excellent research and development has been going on since the days LISP was invented that GC technology is as good as C++ memory management. Don't forget, the C-runtime has to manage the heap as well.

So instead of debating it, accept that both C++ and Java are excellent languages, in a world full of excellent languages where many can be used to develop critical applications.

Related Reading

More Insights

Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.