C++ or Java?

,

My team was wondering whether C++ or Java is a better language for programming for now on, especially considering that FIRST made the transition to Visual Studio and we are trying to use Limelight, which was written natively in C++ as far as I know. A few of our more experienced members in our programming team is fluent in many languages, however most only know Java as that is what the AP Computer Science test is about. This coupled with the fact that we have used Java for quite a while has caused some resistance to the idea of switching languages. Therefore, we wanted the opinions of more experienced and intelligible people in the subject of Java versus C++ to help judge whether or not to switch languages.

Thank you

I am confuse why would you want to switch if Java is working for you? Can you only use the Limelights if you program in C++? (I have never used them.)

3 Likes

Limelight works with both Java and C++. The question we were asking was whether it would optimize our executable considering the compiler is now Visual Studios. I mentioned Limelight as I believe their source code is written in C++ and thought that would affect run-times.

1 Like

Visual Studio Code is different from Visual Studio. Actually, they’re almost entirely unrelated other than by name.

Did you read something that made you believe C++ was going to be faster than Java? Is the reason you’re looking at switching due to “performance”? If so, you might want to take a better look about how much you care about that for what you’re doing currently in FRC? Did you hit a performance wall in Java this year? Was it really because of Java, or was it due to your code?

2 Likes

3rd option: Kotlin

2 Likes

Suggesting teams who may have current misunderstandings of the supported languages to try an unsupported language doesnt seem smart.

Its certainly an option, but so is LabView. Neither are the greatest of ideas in this case.

10 Likes

So my understanding from these replies are that performance has no change based on language. Then, in your personal opinion, which language do you think is better for the students in consideration of future prospects as computer scientists since so many languages are “dying”?
Thank you for replying.

From what I understand (and admittedly it isint alot for FRC programming) any “performance increase” that C++ or Java has is fairly minimal. Looking back at the first post,

Outside of the limelight being written in C++, do you have any other reason to switch? Looking at the docs, they have support for all 3 FRC Supported languages (and python, if you want to go unsupported by the CSA’s/FTA’s at events) so there should be little issue getting it working.

Based on your posts before, without a serious reason to need to switch, its perfectly fine to stick with Java. We switched to it in 2018 from C++ for more personal reasons and havent looked back.

1 Like

I would like for you to iterate on the difference between VS Code and Visual Studio as I am quite inexperienced in this and require advice. On the topic of performance, I believe we did fairly well on the programming side with very minimal number of bugs and it was always fairly caught up with the mechanical side of the robot. I do not blame Java for our shortcomings in any way.

Whatever they are more comfortable with. Our school teaches Java so we have a lot of kids that know Java so Java it is. Before our school taught a comp sci course it was whatever the kids available that year knew or believed they knew.

1 Like

All performance differences are in how well your team is able to use the language. The reason I suggested Kotlin was because of how easy it is to learn (although I’ve never written robot code in C++, so I’m not exactly sure how it compares).

On another note, I would say that Java and C++ aren’t going to “die” anytime soon

2 Likes

VSCode is a lightweight electron-based IDE that can be used for all languages if you install plugins for them. Visual Studio is a very heavy IDE that is primarily used for C++ and .NET development.

Although it is easy to learn if you know Java, it is not widely used anywhere yet. For sustainability purposes, I think that teaching Java would be a better move, especially that AP Computer Science A is taught in Java. If you have incoming students who already know a language, you can spend more time on teaching them robot-specific things instead of teaching them a new language.

2 Likes

I see. We were just trying to settle a dispute of which one would be better for the upcoming season. Thank you for your time and advice.

This is where the problem arises as some students are dedicated to Java yet do not understand enough of Java to actively contribute. However, others are more fluent in C++ and only started learning Java either from the AP Comp Sci class or in order to help contribute to the team’s programming efforts.

Looks like a scenario where in our team we’d have a meeting to discuss it and at the end there would be a vote by those wanting to program and then we live with it. Next year is going to be interesting as we currently have 2 programmers who have never programmed so there is a crash course in Java going on cause that is what they will be taking in the fall.

1 Like

I agree on the point that Kotlin is relatively easy to learn and its syntax makes more sense, at least to me, than Java. However the problem I have is introducing new things to the team and the resistance that arises from this, therefore I do not believe switching to Kotlin considering our general lack of experience, since it is not well known, would be a proper solution.
Thank you for your reply, and I will consider Kotlin as an option.

Thank you, that clears up a lot. I take it then that there is no absolute advantage to any individual language other than programmer preferences.

We have a similar situation where the programming team would possibly have three new members, two of which have no previous experience whatsoever. We also have the veterans, one of which has a very limited knowledge on Java and programming in general, while the others are more well versed in languages such as C++ and Python and have a sub-par knowledge of Java.
Thank you for your reply, I will most likely hold a meeting with just the programming team about this.

Another thing to keep in mind is sustainability. When your current programmers (who may know c++) graduate, will the remaining and incoming students be able to continue programming in C++? While it may seem easier to switch to C++ in the moment, it may not be so great down the road.

1 Like

We recently approached this problem as a team ourselves and found that even at our most generous observation of C++ and our harshest interpretation of Java, it was a good idea to switch. We observed FRC support, knowledge base, ease of learning, etc. So for 2019 we switched from C++ to Java and I’m quite happy with the results.

C++ doesn’t fit our students’ academic repertoire and can be quite confusing outright. Actually being able to write, understand, and finish (!) a training curricula is enormous.

My personal vote is Java, but I urge you to do a weighted objective table and consider the benefits and drawbacks, not only this season but for future seasons.

As to “C++ is for VS”, Visual Studio Code is specifically a different project and product from Visual Studio for C++ / C# development. VSC is oriented around Java, Javascript, and Typescript, with lesser but still functional C++ support given that both are backed by Gradle in a FRC context.

4 Likes