Modern C++ Course For CV (2020)

Why C++?

I would write a book trying to reply to this. C++ is one of the most popular yet powerful languages out there. In our particular field, robotics, it’s still the most popular and most widely used language. C++ has also gained some bad reputation across the years, but it’s usually misunderstood, especially when trying to use it in different domains, where it doesn’t belong to. Make sure whenever you google if C++ is cool or not, they don’t compare it against languages that target other fields(web development, services, etc). If you want to program robots and deploy them to the real world, you will need to use C++. Python is fine for prototyping but doesn’t solve all your problems. If you want to use C, well, you will most likely suffer more than you work. Plus the fact that C++ is slower than C is nowadays yet another myth. For an up-to-date survey, I highly recommend inspecting the StackOverflow survey https://insights.stackoverflow.com/survey/2019.

When learned wisely, C++ can be an extremely powerful tool, plus, it will help you to enter the job market much more easily. I would recommend you to query “robotics software engineer” on LinkedIn and see how everyone asks for C++ knowledge.

But I use Python and it’s fast!

I’m sorry, but you are not using Python per se… You are most likely using compiled from C++ and binded to Python. Believe me, I also love Python, especially for prototyping and scientific work…. but it’s slow. Most of the modern libraries nowadays are written in C++(usually called backend) and binded with some library , like pybind11(usually called frontend) to call the functions from Python. I really good example of how this is done in real life is the Open3D library(which I also contribute) from intel-isl. This also holds true for all deep-learning libraries. When you open the lid, there is a C++/CUDA code running under the hood.

Why “Modern” C++, what does modern mean?

C++ was born in 1985. It has been 35 years since then. Sadly, in the first 2 decades C++ didn’t gain a good reputation as a programming language. This didn’t stop it to make it one of the most used/popular languages in the world nowadays. We consider “Modern” C++ whatever C++ source code came after 2011. This a milestone for C++, since it marked an after and before. Nowadays some people still argue that C++ is slow, or that it’s just “C with classes” and all this sort of argument. All these people are referring(without even knowing) to a really old C++ language. So don’t be fooled by any random guy that speaks badly about our loved C++.

After C++11(in 2011) C++ became a really modern and powerful language. One of its key features is what we, C++ programmers call “0 cost abstraction” That basically means, write good, precise, and high-level software without having to pay at runtime/memory.

Why GNU/Linux?

In our particular field, GNU/Linux distributions(like Ubuntu) are the most common operating system. This is due to many reasons, one of them is simplicity when it comes to getting your stuff done. Also, historically, most software developers(robotics are not the exception) used Linux, therefore, they always supported this operating system. The ROS(Robot Operating System) is only supported in Linux(I think Microsoft is trying to port it). Linux distributions are free! And are the most common, easy to use, system if you want to work with open-source projects. It takes some time to start using this new OS, but once you’ve mastered it you will never want to go back. You will remember the days where you used to spend all your money on antivirus, private software like dark days. Linux is also really fast, in performance, and in how to do stuff. For example, you could hit sudo snap install code on a Linux terminal and install the latest version of Visual Studio Code(a modern text editor). This will require some extra steps in Windows/Mac. Like opening a web browser, look manually for the latest package, download it, hit “next” for 500 times, accept 2000 pages of legal terms of conditions, etc, etc. 

But one of the most important reasons is that… robots run Linux! Since the last decade, this has become the standard in the Robotics Industry. Here is a video of my former colleague(and awesome person) Patrick Doyle explaining some insights: https://www.youtube.com/watch?v=t54T9uemiRU

In short, if you know Linux, you will be able to program modern robots. And, you could also search for the job market and see how everyone asks for knowledge about GNU/Linux. It’s not because we are geeks that like to use complicated stuff

Why don’t we use an IDE?

I can write another book, I wish I can say something like  “just, trust me. It’s better”, but let’s give it a try.

Modern text editors are becoming the standard, both in Academia/Industry due to many reasons, that might include:

  • Text editors allow you to work with the same configuration but with infinite different languages. For example, you can have 1 setup to work with C, C++, C#, Python, Java, JS, Latex, etc. You only need ONE editor for all those languages, not 1 specific IDE for each one of them. This becomes really handy when you work with different languages at the same time. Otherwise, you will need to have multiple IDE opened at the same time, plus, as you know, this will drown all your computer resources.
  • IDE’s hide important concepts and steps in the build process of programs. This is really dangerous in your learning progress. I’m totally fine with you using an IDE if you know exactly what’s going on every time you hit that obscure “hammer=build” button. This damage is really hard to sort out in professional careers in the future. You better know how the tools work once for all, it’s not that hard after all
  • IDE’s provide their own tools that are impossible to integrate into CI/CD. I won’t enter on details here, but trust me, you will need to deal with CI/CD whenever you start working. Text editors and standard tools allow you to work and integrate all the tools in the same way that the CI/CD will use it. For example, the Eclipse IDE might warn you that something is bad in your code(or not) but you will not see this warning when you build the project or when the CI/CD runs. For the HW assignments we will be using clang-tools, that will let you know specifically in your text editor where your error is before you submit your HW. If you skip this error, then the HW will be wrong, but the error itself and the error msg will be the same since we use all the same tools everywhere
  • Robotics/Software companies are completely dropping the use of IDE.
  • Many other reasons, just believe, is the best way!

Why so much homework?

Programming languages are technical skills. I don’t know anyone who learned how to cook just attending lectures. At some point, you need to get into the kitchen and start chopping your onions. C++ is not the exception, the only way of learning it is by using it. That’s why we decided to increase the amount of homework to get you on the keyboard, code in C++ and learn it!.

” You cannot learn bicycling from a correspondence course.”
– anon

Is it possible to use Windows?

So, it’s possible indeed, especially if you have window 10. There is a way to install “Linux” as if it were a program. It’s called WSL(Window subsystem for Linux). And for me, it’s the only way I can use Windows. That being said, I don’t use Windows at all, so expect 0 previous knowledge from my side, but I’m always willing to learn if it’s to help others.

Actually, this question is, for you, if you really want to use Windows. This is more like a vocational topic. If you plan to continue a career related to robotics in general, you won’t get around Linux and software development(in my opinion). I spend extra and personal time trying to make my courses real-world related, and after working in top-world robotics companies, I still consider the way I try to teach is the way that (at least) is most commonly used outside the University. If these are good/bad ways, that’s up to each one. I believe strongly in GNU/Linux, the free software, free minds, and free people, but I’m just a dreamer itself. When I teach, my final goal is to free your mind, not to force you to use a particular tool that is owned by obscure companies and doesn’t let you fly. I will stop now(otherwise I’ll never end). So using or not using Windows is up to you. If you are really interested in a successful robotics career, you better invest some time now than in the future(when you most likely will not have this time) I’ve met awesome and pretty smart people, both in Industry and Academia, that due a lack of knowledge in the tools, they just can’t do some stuff, and this is a pity. Struggling a bit while you study might allow you to don’t suffer in your professional future.

Is it possible to use macOS?

I’ve personally never used macOS in my entire life or any Apple product. So I can’t honestly guarantee you that everything will work under macOS systems. That said, I think that you won’t have any problems at all. macOS is based on Unix, and GNU/Linux itself is an open-source of the Unix operating system, so they behave pretty much the same. I’ve seen both in Industry/Academia people use macOS with no trouble. Of course, you will need to double-check everything before copy-pasting commands. Most of the packages that are built for Linux are also supported for macOS. You will have a proper terminal with a proper shell, and a proper operating system(not like Windows).

As a side note, this year, we’ve dropped the GNU GCC toolchain and we started using the LLVM toolchain, which is an open-source alternative that replaces the classical GNU GCC compiler and tools, developed by Apple, for apple. So you probably already have installed the LLVM toolchain in your system.

Lastly, I still recommend trying GNU/Linux for developing robotics software, it might save you pain in the near future

Is it possible to use a Virtual Machine?

This is completely up to you, I use Virtual Machines but just to try out stuff. You can use it at your own risk, Virtual Machines are, by definition, slow and painful to use in the long run. You could use it for some weeks, but at some point, you will suffer a lot if you don’t run Linux natively. Experience in previous years shows that people that started using virtual machines, never drop this bad habit(because then is too late, all your data/files are there) and then they carry this virtual machine across other courses(Master Project, ROS class, master thesis) and this only makes your life more miserable because everything cost 10 times more and it’s 100 times slower. In short, if you want to use it, but you know which risk you are taking.

Side note: I also met extreme cases, where people that never wanted to get to know the tools, started using Virtual Machines, and even carried this habit to a professional level, working for companies, etc. So you better stop it know 

To which extent will you be able to help with Windows related problems?

I will try to do my best to help you, I have a local Windows installation where I could try stuff, but one never knows if this is enough because the Windows version + which packages you are allowed to use according to how much you pay are never clear. So I never know how to reproduce stuff across multiple windows installations

Should I run GNU/Linux alongside Windows?

This would be the best, especially if you plan to follow a robotics profile. Even so, let me warn you that it might be a difficult/painful process, so make sure YOU BACKUP ALL YOUR DATA before you do anything in particular. Virtual machines could also work, but they are typically extremely slow. If you plan to take only the C++ class, then you will be fine, but for the Master project/thesis in our lab, you will struggle a lot with virtual machines(based on previous experiences)

I have no idea about computer science, Is that a problem?

This is a tricky one…

This should not be a problem but you should know that it will be a challenge! I’m willing to help you with anything, but you might need to put extra effort into order to sort out obstacles. The course is for beginners, but this doesn’t mean that it’s easy. You should have at least some knowledge of programming in general. If you don’t know basic control structures(if/else, for, while) and some key concepts(program, variable, function), you will find this(and any other C++ course) quite challenging. Although this is not a problem, you will need to put extra effort and time into trying to fill the gaps in the concepts you don’t know in advance.

That said, there is nothing that stresses me more than a frustrated student, I can’t tell you how much time and effort you will need for my class because I don’t really know the details of what you know/don’t know, and I also don’t want to commit you to start something that might frustrate you, so, this decision is pretty much up to you… I will be always available to help, and I’m quite flexible in general(if you show interest).