Preferred Programming Language

Our team is trying to decide what language to program our robot with. We are a new team and started last year with LabView, but we have all new team members and thought we should figure out what will be most beneficial in the future for the students - like when they get out in the real world and want to use the programming skills they learn in FIRST. Would love to hear other’s opinions of what we should teach the team that will help the team now, and keep helping them after their FIRST experience.

In my opinion, Java is the most useful for the real world… But, I think that Labview is a very good choice since you can learn it very fast and that almost anyone, even without experience, can understand and debug your code (true story :slight_smile: )…

I think the usual answer is ‘whatever language you know best/can learn most easily,’ and this holds true here. We’ve had a lot of success with Java, but it’s really more about how well the programmers know the language rather than the language itself.

Yes, there are many threads on this topic in CD. And the answer is always the same: python. :stuck_out_tongue:

Nah. Visual Basic is the obvious choice :smiley:

In all seriousness, what do your mentors know? If you have a mentor that has a good amount of experience in one of the languages, I would highly recommend picking that one. If you don’t have any programming mentors, I would personally recommend keeping LabVIEW, and it is usually the easiest to teach and debug in the time you have.

Instead of the whole “do what you know”, I’m going to try and answer this objectively. After all, some people are just looking to expand their knowledge – nothing wrong with that :stuck_out_tongue:

C++: Fast, efficient, but a bit of a steep learning curve for those who are new. Doesn’t offer as much freedom as other platforms like the JVM, but is a good language for those who don’t mind the extra work

Java: Semi-fast, not very efficient, but provides a good tradeoff with the amount of freedom the JVM gives you. Although the JVM eats up RAM like there’s no tomorrow, there’s no denying it’s easy to prototype for and is quite nice for any skill level. You also get a lot of freedom with the language you choose, as Scala, Groovy and Clojure all fit under this umbrella.

Python: Although unofficial, the Python support for FRC is first-class. Testability, wonderful documentation and easy prototyping make it the language of choice for many. The syntax is easy to pick up for new programmers, but remains a powerful tool, although less speedy than the JVM and C++ alternatives.

LabView: Probably the most controversial language in FRC. Some love it, some hate it, and some don’t even consider it a language. Although it’s visual based, it runs quite well on the RoboRIO thanks to National Instruments. Doesn’t give you the same degree of freedom as other languages, but a nice alternative for those who aren’t quite ready to learn a full language, and who learn better visually.

Hopefully that list explains (almost) everything. If you want my personal, subjective opinion, I’ve taken a liking to using multiple languages. Java for control structure, Scala for dealing with data.

Add that creating a nice visual driver station is really easy!

My two top languages would be Java or C++. Java has a lot more resource to find on it, so it makes it a much easier learning curve. C++ on the other hand doesn’t have as much resources on it, but it can be very similar to java. I think the bigger thing is, is how much time do you have to learn. If you have little time, I would suggest going with Java. If you have a lot of time, I would try C++ by following the examples. Overall I’d say Java is the better language for beginning teams.

John

If you are looking for a language that is commonly taught in schools and would be easier to find a mentor who knows, you should probably stick with Java.

If you do not anticipate finding a programming mentor, I would stick with LabVIEW. It is (in my opinion) by far the easiest language to be bad at and still end up with a working robot. And once you get good at it (which doesn’t take very long), you can do all of the same level stuff as you can with Java. I entered FRC with very little programming knowledge. My first year as head programmer, using LabVIEW, we barely had a driving robot. by my second year, still with LabVIEW, we were able to do PID control, path planning, etc. (Note: this was on out test bot, not on our competition bot)

tl;dr I would highly recommend LabVIEW for any rookie head programmer without a programming mentor or knowledge of another language

Some love it, some hate it, and some don’t even consider it a language.

This could also be written as …

Some love it, some hate it, and some don’t quite get the definition of a computer language.

But the advice from all who have posted is on point.

My 2 cents. Discuss it with a mentor. Develop a plan. Enjoy the opportunity to learn something new.

Greg McKaskle

My 2 cents, plenty of teams on here will be able to help you with java/c++. I personally would love to mentor a team If you decide to use java.

Same about labview… And I can do it in french!

We have a bad history for long deploy and build times with Labview… What is a better language for quickly changing and using code?

Labview is simply the slowest… Pick any other code supported by FIRST and you’ll see a very big improvement of the time used to deploy and build…

Our team has used both Java and C++, what we found is that Java is great if you don’t care about optimizations and stuff that goes on lower level. Java is good if you want to create code quickly but have the code run slowly. When we switched to c++, we had a LOT more work to do but the code is much better when it comes to speed, memory management, and overall control. Java’s JVM benefits are irrelevant in this scenario because you are programming for one target. Java allowed us to write bad code really fast and create a buggy, slow, but working robot. C++ allowed us to write really optimized code slowly which runs very quickly and has more functionality. There are somethings we could do with C++ that we couldn’t do with Java, such as dynamically loading the code so that we can make changes to the code on the fly without restarting the robot. C++ also allows us to interface directly to the OS as well, so memory management is great. The performance benefit C++ gave us also allowed us to run a separate thread at 200Hz that uses machine learning. However, java is easier to learn for sure.

C++:

Pros:
-Fast
-Control
-More functionality
-Native
-Multi-paradigm
-Good memory management if you are careful
-Not as limiting as java
-Easy interfacing to OS

Cons:
-Hard to learn
-Easy to mess up badly
-Terrible memory management if you are not careful

Java:

Pros:
-Easy for beginners to learn
-Hard to mess up terribly
-Safe
-Garbage Collection

Cons:
-Forced Object Oriented Programming
-Exceptions
-Slow
-No control over memory allocation and deallocation
-Limiting to the programmer
-Forced Garbage Collection
-Sometimes too safe

TLDR: If you are not that experienced, use Java. If you care about lower level control and optimization, use C++

If you want to pick a language that is going to help you in the real world. It doesn’t matter. By the time you get there they will have all changed. :ahh: They all have uses & chances are you will have to learn multiple languages in your programming career. Work on developing logic behind the program. Developing good work habits such as organization and documentation. Learn how to communicate with people. Programming is really a means to an end. Work to understand the end. Programming languages is more about syntax than anything else.

BTW I hear NASA is looking for a few good FORTRAN programmers for a project that is literally at the edge of the solar system.

From a purely competitive/functional point of view, I’d go with Java for two reasons:

  • It seems that more top teams publicly release code in Java than in other languages (purely based on observation of CD, I have no data for this)
  • The build and deploy times are quick enough that you can change and deploy code if you’re crunched for time on the field

I would go with Java or C++. Although the popular languages industries use will change over time, these two are likely to be around for many years to come. Knowing these languages could also help short term in securing internships whether in college or high school.

There is lots of good information being offered on this thread. I will add that our team uses C++ both because our programming mentor (me) has expertise in C++. But I also chose C++ because it is very similar syntactically to Java but gives the programming a few more tricks and improved run-time performance. The other key element to the decision was that many high schools teach Java (often since the AP Programming test is in Java). C++ is not a huge leap from Java so it is a great opportunity to help these students take that next step and learn another language.

I would also offer this link (http://iel.ucdavis.edu/publication/WhyC.html) to a paper from a few years back that provides some insight into what languages are used in industry.

For students who are already “into” programming, Java is probably the most reasonable option for FRC. For students who are just getting into it, LabVIEW is by far

  • the easiest to start with
  • the best for having multiple people looking at the code simultaneously
  • the fastest for implementing parallel tasks

(all in my opinion, of course).

The important thing to keep in mind is that whatever they learn now very likely won’t be what they use in the “real world”. With that as a guiding principle, I would suggest choosing something unlike what they already might know, on the theory that it’s always good to have multiple viewpoints when approaching a task.