Quote:
Originally Posted by Jaci
I'm just going to bump in for a little bit (again)
A lot of the responses on this thread are claiming that Java and C++ are very similar languages. I can't say I necessarily agree.
Although, yes, Java and C++ share some syntactical similarities, the way the languages work can be completely different. If you learn Java, you shouldn't try to program in C++ 'The Java Way', because that leads to issues and inefficiencies. Take pointers for example. In C++, your life revolves around them. In Java, your life also revolves around them. But the key difference is that in C++ you have to handle it on your own, while in Java just about every little bit of data you deal with is a pointer. This leads to issues if you go in with the mindset "these two languages are pretty much the same", because they're not.
If you want to find a language to use on your Robot, look at the pros and cons behind each, and decide what YOU want to learn and use, there's no wrong answer. But please, don't leave it up to "Learn C++ if you have the time, otherwise fall back to Java", because they're not the same language, they just happen to share a fairly common Syntax. Each language has its own advantages and disadvantages, and it's not as easy as "C++ is more hardcore", because I can promise you that although Java presents a friendly face, there's a lot of more you can do with it if you're willing to put in the time.
</rant>
|
Sorry but I differ with you on some points here. Syntactically C++ is a superset of Java... you could almost say that if you put C and Java it gives you an approximation of C++.
However, I would agree that Java has different conventions that are followed for coding standards and there are differences in the "default behaviors" of the code between C++ and Java as well. For example, C++ uses a "call by value" interface and Java uses "call by reference", meaning that one (C++) requires the use of pointers to allow a function to modify a value passed in and the other (Java) always implicitly passes a pointer (which can also be termed a "reference") and therefore any changes made to a parameter value inside a function modify persist after the function returns.
My point is that if you understand the underlying assumptions (which are always important regardless of the language you are using) in C++ and Java, you are likely to see them as much more similar than they are different. And the advantage of learning them both is that it provides you with perspective on the trade-offs of their variations in programming style.