Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


What language to use for most comatibility

Posted on 2003-10-27
Medium Priority
Last Modified: 2010-04-17

(2 part question)
- I am planning to write an interpreter. Anyone know of any good books on the topic?

- Now the 2 langages I'm considering are C++ and Java

The reason for choosing C++ is Borlands new C++ Builder which can compile the code for windows, Linux and Solaris.

The reason for choosing Java is because Java can be executed on Windows, Unix, Apple and most probably Linux also.

Up till now I have been using Visual studio to design software using C++, but the key elements of this project need to be compatibility accross platforms and SPEED.

Can anyone give me an insight to what code executes faster C++ or Java or is there another langage I should consider when thinking of speed?

Also what Language and Development environment should I use to capitalize on the most possible cross platform compatibility?

I was even thinking C code for a while because it can be embedded (But is it worth the complexity). To use such a low level langauge.

Question by:auk_ie
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

jcwlc earned 500 total points
ID: 9630747
C is not a low level language and C++ is basically a superset of C and gives it an OO flavour. Java was originally intended for web development and removes many of the difficult concepts in C/C++ that programmers had trouble with, namely pointer notation. Java is also 'more' OO by design.

However, any 'engine' type code, such as your interpreter or number crunching or string processing or graphic or io manipulation is handled far better in C/C++. You are much 'closer' to the machine level and can exercise more control over memory and other system resources. Java makes your memory management life easier, but comes at a performance cost.

For best speed, flexibility and performance go C/C++ and stick to ANSI if you want it to run on platforms other than win32.

Also, You could split your program and use both technologies... C/C++ for the intensive processing part, java for the user interface driven parts. Use JNI to get them to talk.


Assisted Solution

harris_c earned 500 total points
ID: 9630793
Check this out:   Comparison b/w C, C++, D, Java and C#



Assisted Solution

marcin1 earned 500 total points
ID: 9630849
jcwlc is right, Java is not good for this project. Java was designed to write portable applications, which can be run on PC, mainfames, and mobile phone.

The main difference is that C/C++ programs are compiled directly to the low-level machine code, which makes it fast, but machine dependent. Java is compiled to the platform independent intermediate language, which can be run on anything that has the virtual java machine. That unfortunately affects speed of application.

The point is that you don't want the application itself to be used on different platform, you want only to port the code, so you don't need the features of Java.
LVL 22

Assisted Solution

cookre earned 500 total points
ID: 9631200
Bear in mind, however, there's speed and there's speed.  

Unless your scripts are expected to be long ones with palpable run times, what does it matter if the C version runs in barely two seconds where the Java one runs nearly 3 seconds?  In a case such as that, I would opt for ease of mantenance - in particular if you expect your scripting language to grow.

Note further that if your scripting language is fairly simple, the bulk of the time won't be spent parsing, it will be spent executing the parsed commands, in which the lion's share of the heavy work will be done by API calls into the same DLLs, regardless of which language was used.

Author Comment

ID: 9635254
OK, so C++ seems to be a winner, But Java did come close behind (speed is essential for me). Ofcourse by using C++ I loose the amount of compatibility I had when using Java. I mean The virtual java machine can run on anything (Apple, Windows, Unix etc.). But The Borland Compiler C++ Builder only compiles for Windows, Linux and Solaris. Does anyone know how I can easily port the code over to Unix and Apple as well.

I'm asking cause so far I only have experience programming Windows 9X, NT, 2K and XP using visual studio. So I want to buy correctly if I want to develop for these new softwares.

I am surprised nobody mentioned C sharp. Some say this will replace C++. And that it is operating system independant. However it does require, Does anyone know what operating systems the dot net framework is available for?

Nobody mentioned anything about a book on the topic of interpreters neither?


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Six Sigma Control Plans

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question