To answer your question, both languages have their strengths and weaknesses. C++ is not necessarily harder than Java.
In fact, JAVA is a very powerful language that is platform independent unlike C++.
Fair enough, if you are writing computer games then C would hold the advantage, but for applications JAVA is very stable, has lots of support out there and does not take ages to program the simple things (like windows, menu's etc like it would in C++).
It is simple, see explanation why Microsoft invent now .net and c# Because normal programmer can't write server that works 24 hours, 7 days in week without reboot in C, C++. There will be a lot of bugs in a typical program with multi-threading and dynamic data structure. And you must be professional and spend a lot of time to catch them.
Language with garbage collection (likes Java, C#) much more stable, and easy to use in such cases.
So you can think less about memory leaks, or wrong pointers, stack overflow, strings library, thread synchronization, bugs and features of your OS...
But more about what your program must do.
Price for it is CPU/memory usage, but now computers double its power each 1.5 years (about).
--------------------------------------------------------------- Yes, C++ is more complex language than java. But it will be fixed in new java release
see version 1.5 (generics,function with variable number of arguments, auto boxing/unboxing, language built-in class enum, and other complicate features) [ June 16, 2004: Message edited by: Igor Ko ]
writing computer games then C would hold the advantage
I disagree with this statement. Java is coming into the games market very quickly. Game programmers are realizing the advantage of writing cross platform game code. As far as performance goes, there is very little difference in Java verses C. I have seen very good games built with Java and performance is not an issue at all.
In the industry, it is simply a matter of using the best tools for the job. If Java is more suitable for my work than C++ or my client dictates that I uses Java over C++, I'd use it, and vice-versa.
If you ask a C++ programmer (probably your professor) he'd condemn Java and vice-versa, best way is for you to learn both & find it out yourself! That way you'd become more marketable & can make a sound judgement for yourself.
Besides, I don't believe having a Phd is equivalent to knowing everything. Nowadays, there're many academics who are just ... academics, i.e., they have entirely no (or very little) working experience, never been out in the industry long enough. They just spend their lifes in school. [ June 16, 2004: Message edited by: Cheng Wei Lee ]
but isnt c++ more of a 'multi-platform'?? think about it. all u have to do is take the c++ code and run it thru a different compiler and it will work great on a windows, linux or Mac and will load faster than Java???
I'd recommend you interpret the original quote as follows: 'Java is sufficiently straightforward that a normal human being can write good code in it - even an idiot can use it. C++ is sufficiently complex and crufty that it takes a genius to produce a good product with it.'
And no, you can't just run C++ code through different compilers and have it work on different platforms. Different compilers accept different dialects of C++, and different platforms have different libraries for interacting with the system, so porting C++ code always requires some effort - sometimes so much effort that it's easier to rewrite the application from scratch for the new platform.
Just a note: "Harder" does not equate to "Better." Someone said, Java is catching up with complexity, look at all the fun new things in 1.5. I would argue that more complex, extra things to have to know, does not mean better. To the contrary, I would argue that more complexity without otherwise gain equates to "worse." C++ is somewhat rawer, and thus requires one to know alot more to write complex programs in (where would I put that preposition to get it away from the end of the sentance?). However, this is a detriment, not a benefit. Java is extremely fluid, which is partly why I'm a bit wary of these new generics.
Originally posted by Joseph George: Just a note: "Harder" does not equate to "Better." Someone said, Java is catching up with complexity, look at all the fun new things in 1.5. I would argue that more complex, extra things to have to know, does not mean better.
I thought he was just being sarcastic.
While I share some of your apprehensions about the new features in 1.5, I also think that with the new "power" comes the responsibility to understand how to use it properly. See my comments in this thread.
As for the question about C++ vs. Java, see Allen Holub's bio at the end of this article: "He now looks at C++ as a bad dream..."
Here's one way to look at the strengths of Java ... I'm in the insurance call center biz and I'd like every line of code I write (or read!) to sing about insurance or customer service. Every bit of code that I have to dig through for housekeeping or computer-science-major cleverness is lost productivity in delivering insurance functionality. Java rates fair to good here. Our team produces quite a few classes with almost all insurance logic, but still has too many that keep our frameworks happy. C++ rates, um, less well. You spend a lot more time keeping the compiler happy, or parsing punctuation just as carefully as the compiler to get the correct undertstanding of what code does.
That's only one measure, tho. Make a prioritized list of the most important things to you - performance, portability, compile time, disk footprint, memory footprint, low level OS access, productivity, look & feel, learning curve, resume building, ease of modification, commercial or open-source frameworks, interoperability, etc. and grade several languages on each point. See what you come up with. Better yet, show us what you come up with!
Check out the article linked to here on JavaWorld, and especially the previous installments of his column there.
He refuses to use CamelCase, instead using underscores. That's only the most visible of it, but symptomatic. Essentially he disagrees with just about anything that's different in Java from the way it works in C++ in his book.
I see your point about the camel case although I wouldn't go so far as to conclude that his nonconformity stems from not liking the language. Which of his books are you referring to?
Ernest Friedman-Hill
,
author and iconoclast
staff
i believe you will find java easier to learn initially than c++ (or c). it eliminates some of the complexities of c++ such as pointers. java is a fairly pure object oriented language whereas c++ is a mixture of the old and new. most commercial interest is in java and not c++. there are far fewer coding changes between platforms when using java.
to become truly skilled in either language will require some years of experience. java makes it easier to write a gui or a threaded application, but to do it correctly, you will have to do your time.
Originally posted by Junilu Lacar: I see your point about the camel case although I wouldn't go so far as to conclude that his nonconformity stems from not liking the language. Which of his books are you referring to?
His threads book. Just a typical statement is the very first line of chapter 10: "In a way, the preceding chapters are a litany of everything wrong with the Java threading model...".
In many ways, that's the tone of the entire book, Java is basically flawed and if only it would be like C++ it would be good. Let Holub guide you on the path to make Java like C++.
1. The Java compiler and run time environment catch (with good error messages) many programmer errors that give obscure messages or just result in bugs or (even worse) leave holes for virus writers in C++.
2. For historical reasons (the early C++ implementations compiled into C), basics like variable size are implementation dependent, making porting an adventure.
3. There is a much stronger trend towards style standards in Java. There are also fewer redundant alternative ways to do things. This means that it's usually easier to pick up and understand someone else's Java source. SDK 1.5 may change this.
4. System code, and games that operate at low levels of abstraction, need the strong pointer manipulation of C and C++. You can do the same things in Java but it gets even more complicated than really messy C. See some of the Java library code.
5. Even with HotJava (sp?), good Java programs require more machine cycles than good C++ programs. However, few applications are so computationally intense as to show any difference.
6. I don't know if javac is written in java, but I'm sure the JVM's are written in C or C++, possibly with some assembler code.
7. The most important issue is: what jobs are available to beginners where you plan to live?
One more comment: There are different kinds of geniuses.
Einstein wrote an excellent book explaining the theory of relativity to laymen.
Jim Gosling has written excellent books on basic Java for working programmers.
Bjarne Stroustrup only writes for the high priesthood of really bright people. His basic example in "The C++ Programming Language" is a recursive descent parser, very familiar to the beginning programmer - NOT! [ June 18, 2004: Message edited by: Mike Gershman ]
Post by:autobot
Humans and their filthy friendship brings nothing but trouble. My only solace is this tiny ad:
a bit of art, as a gift, the permaculture playing cards