Thursday 31 December 2009

Java for Quants? Step 2

Following up the conversation, another LinkedIn member, Daniel D wrote:


Some personal comparisons between Java and C++.
1. Advanced, mature generic programming (templates); Java 1.5 seems to be an afterthought, I suspect it is not even wrong.


Daniel is right. It is an after thought. You want "real" and nice templates, use Scala (runs on the JVM)


2. Memory management is deterministic in C++ (Garbage collectors are non-deterministic)


Again, I agree. However, does it matter? When I write C++ code, I have yet to find a pattern where I need the deterministic behavior that Daniel is talking about; in Java, you can always put the reference to null, or use fancier weak references classes if needed; or use jRockit realtime, or start experiencing with G1.


3. Language features; C++ supports modular programming, in addition to OOP and GP. In Java everthing is an *object*; very convenient, but too restrictive


Well, yes and no. Too much to talk about here. Not everything is an object, like primitive types, but they have a type, ie, you can write int.class if you want to. Scala is much more modular, but everything is an object in Scala. But that does not bother me.


4. Java does not support operator overloading (cannie say Matrix m3 = m1*m2)


Use Scala.


5. C++ interfaces well with the hardware and software drivers


Java as well, via JNI.


6. C++ is terse; Java tends to be verbose


It all depends on the programmer, so not an argument, but in any case, want to use a concise language on the VM? Use Scala.

1 comment:

Tango Juliet said...

Moving to Scala?
http://bettingexchangeresearch.blogspot.com/2009/12/time-to-change-moving-from-java-to.html

Blog Archive