MadSci Network: Computer Science
Query:

Re: JAVA came into use after c++ ?

Date: Fri Jan 12 14:23:02 2001
Posted By: Mike Westerfield, Staff, Computer Science, Byte Works, Inc.
Area of science: Computer Science
ID: 979228792.Cs
Message:

You sound like someone who is trying to learn your second computer language! 
More on that in a moment.

Youíre making some assumptions that have no basis in reality. First, you 
assume that because Java came after C++, it should make a certain type of 
programming easier. As a matter of opinion, I think writing most 
applications in Java is easier than writing them in C++, but the relative 
newness of the languages is not a deciding factor on that issue. C++ came 
about to add object oriented programming to an already popular language. 
Java came about to make it easy to write applications that were both 
portable and secure. In C++, for example, there is no way for me to 
guarantee that your program will not wipe out all of the files on my hard 
drive. In Java, I can do exactly that.

That said, Java is, in many ways, a better language for writing 
applications. Since it didnít start with the baggage of a 30-something year 
old language, Java is also a much cleaner, better thought-out language than 
C++.

Some of your frustration seems to come from the seemingly endless number of 
objects that appear to be a part of Java. Well, they are and they arenít. 
Java is almost always implemented with a large collection of standard 
objects. Unlike C++, which is designed to run with no real knowledge of the 
machine it runs on, Java environments generally assume you will run on a 
specific run time platform that comes along with the language. When you 
learn Java, itís like learning C++ and, say, Windows NT and Microsoftís 
Foundation class library all in one. If you compare Java to the package of a 
language, O/S and class library you need to write real C++ applications on 
Windows, I think you can see that the languages look a bit more similar in 
size. As an added bonus, though, the Java application will also run under 
Windows 98, Mac O/S, Unix with X-Windows, and several other operating 
systems. C++, for all its reputation as a portable language, canít say that. 
Finally, Java as a language is really a separate thing from its object 
libraries. You could implement Java without them, creating a version to use 
Windows and Foundation.

You mentioned that Java has to be told what not to do. I really donít know 
what you mean by that, unless you are referring to the error handling 
abilities built into the language and its libraries. If thatís what you are 
referring to, then I would turn the complaint around. C++ has no effective, 
universal way to deal with error handling throughout the language and its 
object libraries. Java does. In my opinion, Java is the winner on this 
issue.

Finally, you say Java is more difficult than C++. This, coupled with your 
other comments, make me suspect that you learned C++ and have never used any 
other computer language extensively. Remembering back to when I learned my 
second computer language, and thinking about the people who I have taught to 
use a new computer language, the second language people learn seems to be 
the hardest. With the first language, you have no preconceived notions. You 
learn to think and express yourself in that language. When the next language 
comes along, you are forced to think in a different way, not a new way. 
Thatís hard for most people.

I would suggest that you give Java a chance. Accept it on its own terms, 
without comparing in too much to any other language. Look for the things it 
lets you do that C++ does not, as well as the things youíre already seeing 
that C++ can do that Java cannot.

Java is not a perfect language. Iím not even going to claim it is a better 
language than C++, despite what you may read in this note. It is just a 
different language. In the last year I have used Java, C++, ANSI C, BASIC 
and Logo for various projects. Before that Iíve used Fortran, Algol, Pascal, 
several assembly languages, and dabbled with a dozen other languages. From 
that experience, I can tell you there are specific projects you could name 
that would cause me to pick almost any one of those languages, even today. 
(Algol is pretty dead. Itís about the only one I would eliminate.) They all 
have strengths and weaknesses. 

And they all taught me something about how to think about programming.

If you give Java a chance, it will do that for you, too. Even if you end up 
doing almost all of your work in C++, youíll take some ideas back to C++ 
that will help you there. Like error checking, for example!

Mike Westerfield



Current Queue | Current Queue for Computer Science | Computer Science archives

Try the links in the MadSci Library for more information on Computer Science.



MadSci Home | Information | Search | Random Knowledge Generator | MadSci Archives | Mad Library | MAD Labs | MAD FAQs | Ask a ? | Join Us! | Help Support MadSci


MadSci Network, webadmin@www.madsci.org
© 1995-2001. All rights reserved.