Hey all. I’m looking at early offseason projects we can do, and one of them was, just for kicks, try to see if we can program the robot in C++. Actually, its more than just for kicks - we want to see if one of the languages works better than the others, and in any case I believe C++ is used more generally in the industry than Java. So, do you guys think the switch would be worth it? What drawbacks have you guys seen from using C++? Any advice from those who have made the transition themselves would be especially appreciated.
Use whatever language will get out of your programmer’s way, usually that means:
- Use whatever your software mentors know best and can teach.
- Use what students will already know (does your school have an AP CS class that teaches Java?)
- Use what students are excited to use.
Second to that are things like performance, clout, etc. World class robots are programmed in both languages, and how your robot performs on the field matters far more than being a l33t C++ ninja.
Lastly, I’d also advise that you avoid C++ unless you have a mentor experienced in it. It’s much easier to encounter extremely obscure errors that are difficult to resolve. There are dozens of easily accessed footguns, including the
new keyword :p.
PS: try googling “chief delphi c++ vs java” for more opinions.
If you end up using
new in a modern C++ robot program, you’re doing something wrong. Granted, it’s hard to find resources online for modern idiomatic C++.
Java is pretty easy to teach compared to C++, at least in my opinion for beginners programmers. I’d only recommend using C++ if you have a mentor that is comfortable with it or learning it so they can teach and retain knowledge gained over multiple iterations of your team.
Echoing what @Lytigas said. Don’t let the language you use be what is causing roadblocks for your team. That being said, now’s a great time to explore new methods of making your robot work.
Even if it is more than just for kicks… then go for it… It would be a tremendous benefit to your programmers. Learning a new language is both beneficial and fun. (Try Labview too if you have the time.) I have mentored teams using Java, C++ and LabView. They all work great. I think that exposure to multiple languages is more beneficial to high school students than becoming an expert in any one. They will have plenty of time to become and expert in something during their college years or when they join industry. FRC is the perfect time for exposure (and inspiration).
Depends on your industry. At my workplace, we use Python and MATLAB extensively, with some C++. Very little Java.
Insert obligatory promotion of using Python on your robot here.
If you just want to do it for kicks, that’s awesome.
If you’re trying to be more competitive, look the work verse reward. To grow in strength the fastest, you want to do the least amount of work for the most advantage. Will the advantages of C++ over Java out-weigh the drawbacks of having to switch your entire coding scheme? Could there be better things to learn in your time, like PID tuning, motion profiling, or better code structure? Will your teaching structure suffer any from a change? Like many things in CS, there are trade-offs.
In our case in particulars, we have tons more improvements to make before even considering a switch. The relative advantages are far from the benefits we can get from learning to teach future generation better. Also, we have a large number of college mentors who mainly know Java with a lot less knowing C++, so it doesn’t make sense for us to switch.
Asking a question is it worth it, is obviously subjective.
I don’t think that C++ is more widely used “in the industry”, if you are talking about software development as a whole. C and to a lesser extent, C++ are the primary drivers of embedded systems development. So if that is the industry, then, learning C is extremely valuable.
At the high school level though, I think learning HOW to design, and write effective code is much more important that WHICH language you are learning.
So I would say something like this: If the only reason to switch is to get kids ready for industry, I would say stick to the syntax and language they have used thus far, but start to reinforce the industry-grade development practices that will help them out.
Just as an example, the new Command-Based Java framework goes that direction wherein the old framework the template project has a bunch of public static references…which is a bad sign in a professional environment. So learning about composition, inheritance, encapsulation (and the other principles that are critical in a type-safe object oriented language) is much more important for the kids professionally than is knowing how to use WPILib in C++ versus Java.
Thanks for your responses guys, it really helps
I think I’m going to keep using Java for now, as I (software lead) am graduating and we do not currently have a software mentor, and Java is the language we’ve been using. That said, we’re going to try and see if we could reprogram parts of the robot in C++ as a sort of mini-project for the sake of the exposure to new languages, and maybe learning a thing or two. But we have things to consider before changing languages. Again, thanks
Honestly, if you have to ask, no. Stick with whatever you like more
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.