Name:
Location: Orange, CA, United States

Thursday, August 31, 2006

C++ vs. Java

Over a mediocre meal I recently had a vehement coversation with another programmer about the best uses for the C++ languages vs. Java.

After we'd gotten done cracking jokes about how "Java is great if you want to load 250 megs into RAM just to print 'hello world'", and "C++ is perfect for people who have bosses that don't mind them spending all day writing string and memory handling objects instead of application code", we covered the various pros and cons of the languages.

Here's the Cliff Notes:

Java:

Use it when development time is more important than application performance. Suited for large complex projects since the language and associated APIs lend themselves very well to managing this complexity, and allow for much easer porting (little to no per-platform code). Inferior system-level integration (i.e. you can't easily get down and dirty call OS-specific calls, provide native (C) callbacks, etc.) as compared to writing in C or C++, plus system-level code often has performance requirements that make Java prohibitive.

C++:

While C++ with its language-level bells and whistles like operator overloading and multiple inheritance can be built up into a much higher level and object-oriented environment than writing straight C - it still doesn't cut the mustard when you are talking about large enterprise applications. C++ has significant performance advantages, so it's suited for system level work, as well as smaller programs in which the developers can more easily cope with the added complexity that comes from having to manage memory, be careful with pointers and casting, etc.


Alas, we all must select our weapons before each battle (use the right language for the project at hand).

0 Comments:

Post a Comment

<< Home