Dear programmers, why did you choose C/C++, Java, Python or another programming language for your team?

New to this forum thing, not sure if this belongs in Technical/Programming or Technical/Discussions, apologies if I did anything incorrectly :>

Made this question because I haven’t seen it asked anywhere (AFAIK, if there is a thread/discussion about this I’d love and appreciate if I can get a link to it, ty)

EDIT: thanks to everybody who responded! I appreciate all of your insightful and interesting comments :>

We use Java because it’s the best supported language and is taught in AP Computer Science A (tends to be a huge advantage since lots of students already know it).

3 Likes

Our team has used Java for every season, as far as I know. I did not choose it, but I chose not to propose switching from Java during my team as programming officer. Java is the language taught in our school’s computer science classes, so it’s easier to use it and not force team members to learn another language on top of all the other difficult aspects of FRC programming.

1 Like

As a CSA, mentor, and local “that guy”… my answer to any team trying to answer that question will be a few questions from me.

  1. What language do you have the best teacher/mentor support with?
  2. What language is taught in your school (assuming school-affiliated team)?
  3. See question 1

Seriously though, never underestimate the power of good mentor support. All the languages have an abundance of excellent documentation at this point, so there’s really no reason to believe any one language is inherently better or worse than the others (except labview of course :face_vomiting: /s). Mentors provide long-term continuity within a team, so their support is crucial.

3 Likes

When I was a student founding a team for the 2011-2012 season, I picked Java because:

  1. A Text-based language made more sense than LabVIEW Since I wanted to go into CompSci
  2. Java is generally simpler than C++
  3. I already knew other text-based languages (PHP, JavaScript, a little Arduino)

Nowadays I would add that it is super well supported, as well as the most used. It was not when I picked it.

As for what language a given team should use, I agree with @Fletch1373 above. Go with what your team members and/or mentors know, or what makes the most sense for the future/career goals for your programmers.

1 Like

cool, our school doesn’t have AP Computer Science. but we do have CS classes, they teach scratch, and python to freshmen, then JavaScript with frameworks like React, Vue, etc.
I teach new teammates Java as it is not taught in my school, and am also the Lead Programmer in my team.

Although I know someone who goes to Brooklyn Tech, they have AP Comp Sci there, and they teach Python to freshmen/sophmores, not sure what they teach to Juniors or seniors tho.

And just out of curiosity, would you have used a different programming language if it was officially supported, and taught in schools? (like C# or Python)

Thanks for answering :>

Dating myself here, but I ready “2011-2012 season” and my immediate thought was “huh… I thought they were older than that”… yeah, I totally thought 2011-2012 was a couple years ago…

1 Like

As a mentor, here’s why I choose to teach Java:

  • I deal with enough C++ at work
  • Lots of documentation and tutorials
  • Much less to deal with concerning object lifespans (I’m looking at you C++)
  • Statically typed makes it more concrete to read through for beginners (I’m looking at you Python)
  • Variable scope is straightforward to teach (I’m glaring at you Python)
  • Lambdas make everything better, and functional interfaces are nice
  • The other mentor won’t let me teach Kotlin
7 Likes

Lol. Yeah. 2012 was 3946’s rookie season. That was also the first season of the Command Based Robot template/framework, which was fun. I learned how to write robots in WPILib based on Iterative Robot over the summer using code from other teams on Github to learn conventions, and then had to learn a whole new framework when the season started because I knew it was better, lol.

1 Like

At least LabVIEW isn’t as bad as MATLAB lol (/s).

My school doesn’t have AP Comp Sci, but they have Comp Sci classes where they teach JavaScript, and Python.

We ended up using Java, like almost every other team, because it was most similar to Python and JS, was well supported.

I was able to pick it up quickly, as I had experience with gamedev/programming in C#.

We could’ve gone with C/C++ but C++ makes me heavily rethink my life choices and I didn’t want to deal with manual memory management and the other complexities of C/C++. Java let us programmers write code very quick and test it out.

(I like C tho, I could argue all day of how I dislike C++, but we’d be here until the end of time lol)

On a somewhat-unrelated note: I wish WPILib had support for Lua (or LuaJIT) programming, Lua is a great scripting language that I feel is very underrated, it has a lovely C API that can be used to extend C libraries, frameworks, functions into Lua and an unparalleled speed compared to other (interpreted) languages. It’s also quite similar Python in some ways!

However I can also see why the WPILib devs/team probably wouldn’t add support for Lua; The library codebase is massive and binding C/C++ code to Lua would definitely take a lot of time, and resources. This would also mean that they have to support 3 programming languages now.
Anyways that concludes my random spiel haha. I enjoyed what you had to say!

Thanks for your insight! :>

We use Java because that’s what our initial mentors and team members from 6 years ago knew, and we now everyone on the team who wants to learns java in order to program the robot.

1 Like

My team has made the switch to Python this for a handful of reasons.

  1. Our local school district seems to be anti-programming in their STEM offerings (for some friggin’ reason. They love STEM otherwise! :upside_down_face: :upside_down_face: :upside_down_face:). So there’s no real basis to work from, meaning we can do whatever we want.
  2. Python is just so simple to teach. There’s minimal syntax, and every concept flows (more or less) nicely into the next, without having to introduce libraries and functions or classes in the first lesson.
    2a. Python has very little “don’t worry about it, we’ll cover this later, this is just how it is for now”, and no unhelpful boilerplate, which is so frustrating to teach and learn (see: “hello world” in C++ and Java requiring everything but the kitchen sink to just compile).
  3. Jupyter means I can write interactive lessons instead of just giving lectures or a textbook and homework, and it works in VS Code, so they can get used to the editor without being dropped in blind.
  4. I got real tired of trying to explain what pointers and references are to students who had never programmed before just for one little, technically optional part of WPILib.
  5. I don’t like Java, and I was making the decision.

It also doesn’t hurt that we are basically restarting our programming team from scratch, so it was a good time to switch.

2 Likes

"The other mentor won’t let me teach Kotlin"
lol thats me except with Python hahaha.

Some of my other programmer teammates (especially newer programmers) want to use Python, because its very readable, easy, and some of them are already learning it in their CompSci classes.

And I’m aware that there is a community-built Python extension/wrapper for WPILib, but it’s not officially supported and is not used much in FRC (AFAIK)

C++ has smart pointers to deal with the memory stuff, but those create their own nightmare. Give me C and manual management of everything any day over that. C++ is a horrible (albeit fast) dumpster fire that constantly reminds me of the “How do you do, fellow kids” meme with the constant influx of features it was almost certainly never originally imagined to have (not trying to speak for Stroustrup, but still).

It wouldn’t be totally unreasonable to do the same thing with Lua that RobotPy does. All it does is wrap the C++ version of WPILib, and makes it available to Python. Obviously it would be a lot of work, but if you can make some kind of auto-generator for the binding code, it’s conceivably possible, and largely only relies on the stability of the C++ version of WPILib. (I sincerely don’t recommend this for a casual project.)

1 Like
3 Likes

Intresting… :thinking:
thanks for bringing this to my attention! Might try python programming after competition ends.
:>

1 Like

4645 uses Java. Our two mentors who are also CS teachers know and can follow along with Java code, which is pretty much a neccesity when we have code reviews. We also find it easier to teach Java to the new students because they might have come directly from Programming I or APCSA.

We considered Python, as well, at the start of this season but the senior programmers decided against it for another year.

2 Likes

C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off”. - The man himself, Bjarne Stroustrup

Totally agree with you with your opinion on C++, it has some cool stuff that makes coding in C a lot easier, but at the same time its become so needlessly bloated and over-complicated. I just want C with classes, String data type, and maybe a few other things. But this is not a perfect world.

I wish I had the time and resources, or manpower to bind C/C++ to Lua but I don’t, and I also never want to touch C++ code again.

Whenever I chose to bind C libraries or API’s to Lua I’d do it from the ground-floor/ground-up. What I mean by that is I would have planned ahead of time to add support for Lua programming.

Another thing that I can’t do is maintenance of the library, it would just be too much.

1 Like

Fun fact: my inspiration for creating RobotPy was 973 writing a Lua wrapper:

2 Likes

Never knew a team wrote a Lua wrapper! I wonder if it is still maintained/up-to-date (probably not tbh).

I’ll definitely look into how they implemented it… :>