From Java to C++
With my most recent job change, I transitioned from programming primarily in Java to C++. I had used Java throughout college, as well as for my entire industry experience up until that point. I was pretty nervous about the transition, but it turned out to be easier than expected.
Core Differences
At a fundamental level, the languages differ on some core concepts. The elephant in the room, of course, is that C++ does not have memory management like Java. Fortunately, this ended up being not as troublesome as I thought it would be. With some luck, I joined a relatively modern (C++11) project. That revision introduced smart pointers, which really help remove a lot of the typical memory management pitfalls.
The pass-by-value model is definitely something to keep in mind, as well. It's bitten me a few times, but it's usually pretty easy to resolve. Once you really get used to the ideas behind pointers and references, things mostly start to click into place.
Paradigm Differences
Another interesting thing to note is, from what I've gathered, many C++ projects tend to favor composition over inheritance. There's a variety of good arguments for both that I won't go into, but coming from Java where everything is a class and inheritance reigns king, it was a bit of a speedbump to wrap my head around the design pattern.
Another interesting thing to note is that the singleton pattern doesn't seem to show up nearly as often in C++ projects, and for good reason. There's a great rabbit hole to go down starting here, if you're interested.
Tooling Differences
In my experience, the average C++ compiler can be much more cryptic in its errors than the Java compiler. Learning what the hell an lvalue is, how it differs from an rvalue and why any of it matters was something that took me a while to understand. I even wrote a post about this quest. In my Java experience, the compiler was mostly something I passively considered, at best. Learning C++ really forced me to take a closer look at compilers (and the linker) to understand what was going on with some of the errors I was getting.
Another tooling difference I found frustrating was testing frameworks. In Java-world I was pretty happy with Mockito and AssertJ, which I found to be powerful, verbose and easy-to-use test frameworks. My experience so far in C++ has been limited to Google Test, which is great in its own right. However, it definitely feels a bit clunky and rough around the edges when compared to the Java counterparts.
Language Features
The last, and simplest difference, is mostly syntactical. This was obviously not a huge hurdle, but worth mentioning. The separate definitions of header and source files and the syntax around defining and instantiating classes was a bit awkward to hold for a while. Language features like destructors, free functions, structs, macros and other pre-processor directives were not complicated to learn, but worth noting.
Closing Thoughts and Resources
Overall, like mentioned before, the jump from Java to C++ was not really a difficult one. The book A Tour of C++ by the language's creator Bjarne Stroustrup was a worthwhile investment. I also really enjoy The Cherno on YouTube for learning about one-off concepts such as smart pointers, move semantics and other core concepts. Happy coding!