I have some experience in Java programming and enterprise application development. I have done OOP, data structures in C++ for my undergraduate studies. But I couldn’t touch C++ for years. Now I am interested in C++ again and I would like to polish my C++ knowledge and become an expert in C++ . How do I start my journey in C++ again?
In this journey would like to learn some advanced concepts in C++ like network programming, distributed computing,.. etc.
3
Obviously there are a lot of areas you can look at, STL and Boost libraries spring to mind, but as an ex-Java developer you need to fix up the basic concepts that are different first.
Chief amongst these is object lifetimes, in Java you have a GC and finalisers and all that, with C++ you have explicitly defined scopes and deterministic places where your object will (automatically) go away when it leaves scope. Typically you create an object on the stack rather than the heap in C++, and let the compiler decide when to free it. Do not think that you have to create all objects on the heap and let the GC decide when they’re no longer used. If you do need a longer lifetime object, or a large one that would suit living on the heap, use a smart pointer class to manage it. You might want to check up on the latest spec with its features like lambdas and especially the move operator syntax too.
Google for RAII and make sure you learn C++ scopes, its trivially easy, but like many things that are easy you need to take the small amount of time to understand them.
I would suggest one piece of advice, go on stackoverflow, look for unanswered questions about C++ and try and answer them. The amount you learn from answering questions is immense, and you’ll be surprised how often they tend to crop up as issues further down the line for you.
Disclaimer: What you read here are my personal ideas and they are not necessarily correct or widely accepted.
In short, practice! and probably more practice. If I want to talk in detail, there are few things that I like to point out. I was in more or less the same situation, having some experience in java and knowing c++ in surface.
To master c++ neither books nor video lectures were so much of help. Don’t get me wrong, books are fine but in my case, it was only a matter of checking syntax or knowing the concept in detail. What really helped me, was developing couple of very serious projects with c++ and while doing that, I pretty much mastered some of the most important concepts. So again, practice, doing projects and meanwhile knowing what you are doing. By “knowing what you are doing” I mean you should know what exactly your code is doing (e.g. what is the difference between pass by reference and pass by pointer and etc).
Moreover, you should learn some details like how the compiler and linker work, what are macros and more. The point is, java is very nice language when developing(personal opinion); it’s easy and fast to develop and you don’t really need to be worry about lots of programming aspects. C++ on the other hand is not that easy. If you want to really master the language, you should know about the details of compiler, linker, macros, debuggers and etc.
I don’t want to start a battle of operating systems here but I strongly suggest to work with linux. Nice architecture of linux allows you really see how things work and tools like cmake (which is cross platform btw) allows you to have a better understating of the compilation process. If you don’t wanna use linux, at least forget about automated IDEs like ms visual studio where everything happens with a simple click.
But if I want to make only one suggestion, I have to repeat again: PRACTICE!
4