Solved

What language to use for most comatibility

Posted on 2003-10-27
6
224 Views
Last Modified: 2010-04-17
Hello

(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.

Regards  
0
Comment
Question by:auk_ie
6 Comments
 
LVL 1

Accepted Solution

by:
jcwlc earned 125 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.

0
 
LVL 8

Assisted Solution

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

http://www.windevnet.com/wdn/webextra/2003/0313/


hec",)
0
 
LVL 1

Assisted Solution

by:marcin1
marcin1 earned 125 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.
0
 
LVL 22

Assisted Solution

by:cookre
cookre earned 125 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.
0
 

Author Comment

by:auk_ie
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?

   
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupNoAdj 7 86
word0 challenge 3 78
wordmultiple challenge 12 118
SUM 2 INTEGER ARRAYS INTO 1 10 93
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now