HACKER Q&A
📣 KA01

How to approach learning C, C++, or Java on free time?


I've used Javascript and NodeJS in my professional career for the past few years. Many company's job descriptions require knowledge of c, c++, or java. I've decided to learn c and c++. How should I approach learning them? Should I just build projects with the languages? If I decide to not learn these languages will it hurt me when I apply for roles that are looking for expertise in these languages?

I've read K&R and started to build some of unix commands.


  👤 michaelg7x Accepted Answer ✓
I think this depends to some extent on the type of job you're going for, which might seem trite but a graphics role is going to be different from a systems programming role.

I've been writing Java for a long time and tired after a while of the JVM "getting in the way", and the lack of bare-metal acceleration available. Eventually designing and working on zero-GC systems led me to wonder why we didn't just write it in a compile-to-native language in the first place. I skipped both C and C++ and started hacking on x86 and amd64 assembly. It turned out that approaching C after that was fairly straightforward, with the dark corners of the standard libraries forming the still fairly gentle but steepest parts of the learning curve. I've been writing a toy project in it for a while and it's been a lot of fun. Implementing what I understsand to be Modern C's Best Practices have left me with something fairly usable :-O

I've also looked at what you'll probably hear called Modern C++, but IMO it's and order of magnitude harder to get started on. I was watching Nicolai Josuttis' "The Nightmare Of Initialization in C++" the other day[1], which chimes with the first chapters of Scott Meyer's "Effective Modern C++". What a mess (C++ initialisation, not the book)!

Java's potentially a better bet in the wider market as the number of job listings could be higher, but others may disagree. That said, Java is now a vast ecosystem and you'll need to learn at least one of its various build tools. I'm not sure whether it's worth recommending a set of third-party libraries to learn, as each shop will have their own preferences. Being aware of the larger Apache projects and what they offer will probably help. Perhaps even start hacking on one of those or become a contributor?

If you feel you'd rather get into C or C++ then I'd recommend getting a deeper understanding of data-structures, as well as your target OS's IO APIs. You can be very productive in Java before you have to think too hard about them.

HTH.

[1] https://www.youtube.com/watch?v=7DTlWPgX6zs