Someone just asked me about getting more proficient in C++, and with their permission I thought I’d share the question and my answer in case it’s of broader interest to folks wanting to improve their C++ skills.
Here’s the question:
I need to take my C++ knowledge up a notch – or two. On a scale of 1-10 I’d consider my C++ knowledge a 5 and would like to get to 7-8 in the next 4, or so, months. As C++ is a large language my quandary is what subject areas, using what study materials, should I focus on to get myself to this next level.
Questions (assuming that I’m going to study approx 2 hrs/day for 4 months):
1. How would you suggest I structure such a course of study (subject areas, 5 of time for each) ?
1.1 If you were in my shoes, how would you proceed?
2. If I was going to study and hopefully know cold one of your books, which do you think I should select?
Here’s my response, which I didn’t limit to my own books. These are the first two “next books” books I would recommend to anyone who already knew the basics of the language and wanted to improve their proficiency with using C++ in production code:
If you’re not already familiar with Scott Meyers’ Effective C++, the current third edition is the plate to start (it’s substantially reworked since the first and second editions).
After that, I’d say the most important is C++ Coding Standards which I wrote with Andrei Alexandrescu. Not only does it cover the top 100 things we felt were important to say about using C++ in production code, and had its guidance peer-reviewed in advance by a who’s-who of the C++ community more than any other C++ book I’ve ever heard of, but it also includes references in each Item for where to find more in-depth treatment. Most Items are just one or two pages, so if you know that Item already you can use it as a refresher; and if you discover ones that you’re less familiar with or rusty on the details, it tells you where to go to find out more.
I’d say those are the two most important that I can suggest. Best wishes with your studies!
+1 for Stephen Dewhurst’s books (C++ Gotchas and C++ Common Knowledge).
Björn Karlsson’s Beyond the C++ Standard Library: An Introduction to Boost is a start in that direction.
Well, I’m aware of the documenation what I’m missing is examples of usage of all these components together. One great place to look for such examples is boost::asio documentation(http://www.boost.org/doc/libs/1_38_0/doc/html/boost_asio/examples.html) but it would be great to have more similar examples and howtos showing modern c++ style programming.
What I’m really missing is a book on _modern_ C++ idioms and libraries(e.g boost): move semantics, safe bool, optional, tribool, shared/weak/intrusive_pointer, tuple, asio…
It’s not a book, but why not read the boost documentation?
All books by Meyer, Sutter and Alexandrescu are great and a must read for any serious C++ programmer. What I’m really missing is a book on _modern_ C++ idioms and libraries(e.g boost): move semantics, safe bool, optional, tribool, shared/weak/intrusive_pointer, tuple, asio… I can go on and on ;)
Meyers’ books, including Effective STL, are great because they distill the knowledge and experience of many who have gone before into easily understood and helpful snippets that can be tackled piecemeal.
There’s Dewhurst’s C++ Common Knowledge. A short compendium of things every C++ developer should know about the language, and will eventually learn anyway, but probably doesn’t know yet. It starts from rather basic things, treated quite thoroughly yet pragmatically, and moves to many intermediate topics, including templates. This is probably the best book to read after Meyers’ Effective C++ and More Effective C++.
Matthew Wilson’s Imperfect C++ is a good book because it shows you imperfections in the language and useful workarounds and techniques that come into play IRL.
Herb’s own Effective series is likewise great because of the real world problems it addresses. If one takes the time to try to answer the questions independently, the items are thought provoking and the answers will be all the more meaningful when compared to one’s own.
Finally, templates cannot be long ignored in modern C++, so there are two books I recommend in that vein. Vandevoorde’s and Josuttis’ C++ Templates: The Complete Guide starts with a easy introduction to templates and progresses to advanced treatment of the subject. It is well written and neither condescending nor academic. After that book, Abrahams’ and Gurtovoy’s C++ Template Metaprogramming will be accessible. It is a difficult but enlightening book.
@xyzzy & Dan
I think “10” should be “perfect knowledge”, and down from there, where being able to solve a problem is “6”.
“5” is being unable to solve problems in the language, down to “0” not knowing what C++ really is (never heard about it).
“Innovator” should be definetely off-scale; if you go at school, believe me, you can have the top vote without inventing new theorems.
This is the scale most people is used to, imo, and so they rate themselves according to it.
xyzzy –
Right on. I’ve been doing C++ since 1995, including some large-scale projects, and I usually rate myself in the 6 range. There are some dusty corners of the STL that I always have to look up, I’ve never used virtual inheritance, and I rarely use any standard I/O calls (mostly real-time embedded stuff), and I’m *slowly* working through Alexandrescru’s “Modern C++ Design” on my own time (not much of the material is directly applicable to my daily work, but I think it’s important to understand, if nothing else, to help expand the way I approach a problem.)
I consider a “7” to be “can look at almost any C++ code and understand without problems”, an “8” to be an innovator as you said, and a handful of people on the planet to be 9s. 10 – I always leave this as “the person’s probably out there, we just haven’t found him yet” (or maybe it’s Stroustrup).
It’s funny, when I interview people, they usually peg themselves as 7-8 range (I don’t give them my “scale” ahead of time), and I’d put them in the 3-5 range most of the time. 3 = “C/C++ on resume”, i.e. “I’ve never really done much C++, but I know there are classes and inheritance.”
One of the things I’ve discovered during my journey is that the more I learn & know about C++, the more I realize there is a lot more to learn. You can be functional, competent, even proficient, and still have a lot to learn.
I actually have a follow up question. How do you balance the never-ending process of learning C++ with learning other languages and technologies? I have spent a lot of time studying C++ to the detriment of learning .NET, C# and Objective-C. Unless you are a genius, you need a plan for becoming effective at these technologies and still giving your C++ expertise the time it needs to mature.
Any ideas?
I have had a number of interviews in which the interviewer asked questions straight out of “Inside the C++ Object Model” by Stan Lippman. Reading it may not make you a better C++ programmer but you will be more comfortable when an interviewer tries to put you on the hot seat.
The most important thing is to write code. Make toy examples of all the good tidbits in Meyers’, Sutter’s and Alexandrescu’s books/articles.
I think, it’s import to not only learn the language itself, but the tools it offers, and technologies where it’s applied.
As for libraries, it’s important to get familiar with STL and boost libraries since they are used virtually in every recent project.
For the technologies, I’d say someone should learn either WinAPI or linux system calls at very least.
Without that knowledge, knowing the language itself doesn’t make sense.
I used the C++ Coding Standards myself, and it’s true; it’s a VERY good book for getting things right when you’re new to it or unsure of things. It’s very easy to know what you _can_ do in C++, knowing what you should (or shouldn’t) do is a bit harder. For example, “throw by value, catch by reference” (rule 73) is not that obvious, given that you could throw/catch just about anything in C++, but it’s a very good rule of thumb.
(that’s google’s internal scale of expertise)
8 means you are innovator in c++. 7 means you are very profficient.
that guy won’t get to 8, but 7 is reachable in 5 years.
I think this is an interesting and difficult question, and I’m not sure what “level 5” really means. The two books you mention certainly merit a place on any serious C++ bookshelf. I think I’d add Josuttis’ “The C++ Standard Library”.
For learning the language, though, I’d want to focus on reading, writing and running C++.
I would also recommend joining ACCU.
I’d also recommend *very* strongly Artima and Dr Dobb’s Journal articles :
http://www.artima.com/cppsource
http://www.ddj.com/cpp/
Many introduce useful techniques people will probably need some day.
Also recommended : Modern C++ Design, if one wants to discover the power of templates, and even better, the combination of templates and OOP.