I am mentoring multiple teams and looking to start moving them away from block coding. Our club has been exclusively using blocks for years, but now that they are getting more advanced and want to program more advanced processes they want to start switching to text based programming. I know VEX uses both C++ and Python, but with no prior experience I don’t know how to describe the differences between them and the pros/cons to them.
From teams that have more experience with text based coding, what are the big pros/cons and differences between C++ and Python?
This is a very complicated question. To answer this, let’s look at the main characteristics of both Python and C++.
Starting with Python, it’s an interpreted langauge that’s often taught to beginners because it’s very simple. It gets the job done for most tasks but doesn’t give you much control over how your machine executes code. It’s extremely easy to learn and for now would be able to do everything you’d need. However, as you get to more advanced programming concepts like odometry, Python’s slow execution speed can start to become an issue.
C++ is blazingly fast because it compiles into machine code before it is downloaded onto the brain. It’s extremely powerful and gives you the option to manually manage the program’s memory. However, superpowers like that come with strict rules and the language can be more difficult to learn. You can also run into issues that can be difficult to track down and fix, especially if you are using pointers incorrectly.
The other advantage to C++ is that there are tons of templates and codebases you can use. For PID and odometry, JAR-template is a great option. I haven’t used it myself but I’ve heard great things and seen many extremely successful teams use it.
I’d recommend C++, especially since you don’t have to tackle the tricky things right away if you don’t want to. A good understanding of control flow, variables, and functions is all you need for almost everything in VEX. learncpp.com has great tutorials for everything C++.
Good luck with your coding!