A new Programmer

Hi my name is Kyler, I am the new Head Programmer as our old programmer has left us to go to college. Now since i have got that out of the way…

I have started c++ over the summer and can basically make a calculator… (I know not good) but i want to program in c++ because he left me all of his code (Plus i find it interesting since i am a computer wiz) All i need to know if i should just continue to learn c++ or did what he did and focus on programming just for the WPILIB Library?

Programming with WPILib is a whole different ballgame from basic arithmetic. However, if I were in your shoes, I’d keep learning C++ in general. Here’s why:
WPILib focuses on providing you with objects through which all the work to interfacing with the robot is done for you.
If you continue learning C++, especially using any non-standard libraries, you’ll run across objects sooner or later. There’s a two-way learning process here - what you learn in this way will be applicable to WPI code, and vice versa.
If you learn one multi-paradigm language like C++ well, picking up another language (unless it’s Haskell or something ridiculous like that) is generally a case of getting used to some different syntax.
If you’re planning on doing anything related to programming in the future, C++ is a good place to be, and the more you know, the more you are able to do.

Cheers, and hope you have fun learning C++!

I was given some advice that really helped me when I was in your shoes. Now its time to pass it on:

Its the strategic part of programming that you are going to struggle with. Getting your ideas translated into code that isnt difficult.

I really took this to heart and stopped worrying about “learning” c++ and dove right into programming the robot. I kept a c++ reference with me and basically looked up how to do everything that had to do with the language (syntax) part. I wrote the code in English of what I wanted to do (I did this at home so no one would see). And then translated it into c++. I feel that I was much more effective with this manner because by the time competition came around I was very familiar with algorithms (such as PID) which is wayyyyyy more important than being able to recite the for loop syntax or “strong” vs “weak” typed languages. You will have ample time latter to learn this stuff.

Just remember, to become a good programmer, you need years of practice. It is just like any sport, skill, activity. Once you start to get the hang of programming, there will be more curve balls thrown at you and you will need to learn how to adapt. While I do agree on not focusing on C++ as in the syntax, but I say focus on C++. It is not all black and white as you may think; syntax goes hand an hand with the whole “programming” part of it. What I mean by that is that you may have all the pseudo code on paper, but you might not be able to translate that into code without knowing a lot of syntax. It is hard to explain what I mean. If you did not know what static functions are, you might have had to change up the class hierarchy to accommodate what you wanted to do. Learn what is inside your tool box; you do not want to be using a hack saw to cut down a tree while a chainsaw is in your toolbox.

By all means, go learn algorithms, but learn how to think. Thinking is the most important aspect of coding. Always get in the habit of pseudo coding before touching the keyboard. If you are stuck, just sleep on it. Chances are, if you are tired, you end up doing stupid stuff. Like last night, I was writing a sorting algorithm late at night, but I I ended up with this 200 line class. It was not pretty, but I reduced it down to 40 lines or so.

This captures the entirety of learning how to really code. Well said!

One of the best things you can do to learn how to program the robot is to try programming last year’s robot again from scratch. Heck, try to make it even better than last year’s code. You have months until the season starts. Try to write a 2 tube autonomous mode. Have fun with the robot. You don’t need to know lots of crazy C++ language features to be able to program the robot well. If you find something that you don’t understand in WPILib, then take the opportunity to learn about that language feature.

My experience with FRC programming has been that figuring out which algorithm works best to solve the problem in front of me is the hardest part. It is quite hard to figure out how to get the robot to do what you want it to do, and that problem is just as hard to solve when writing pseudo code as when writing C++.

I have also been work for years on how to structure the code in such a way to make it easy to maintain, quick to try new stuff out with, and flexible. It is easy(ier) to write code to get the job done, but hard to make it so that you can fix it quickly when you catch a bug in the heat of competition, or so that it is easy for someone new on the team to quickly get up to speed.