Guys, I need to find a good site like codingbat to "learn again" C++. I learned it at school but then I've never used it seriously. I'm not looking for something like Project Euler because it focuses on math problems. I need something really focused on C++ principles, chacteristics and tools.
3 Answers
I don't think such a site exists and I doubt it ever will. The reason is that C++ is huge - and I mean reeaallllyyy huge.
When you start to write C++ code professionally (that is, 40hrs per week) and take 1 or 2 hrs for learning new stuff about C++ every day (that is, 5-10hrs per week), reading books and articles, you will need months, if not years, to become a real professional C++ programmer - unworldly presuming your job doesn't require you to learn any 3rd-party APIs, new tools, technologies, and whatnot, which will distract you from learning C++.
For several years, I have taught C++ to students who already had one year exposure to Java. In 4-5 months, 12-15 lectures, and at the very least twice that time in the lab, I've managed to drag them from "Hello, world!" all the way to a short introduction to template meta programming. Everyone who know all of the area covered by that span will tell you that, after this, they'd still be bloody novices.
(Heck, I'm using C++ for >15 years, earn my money writing C++ code >10 years, and still learn new stuff about it almost weekly. And that's not even considering the huge amount of stuff dumped over us by the new standard, which has been "just around the corner" for several years).
Due to the sheer size of the territory to cover in order to learn C++, and also due to the fact that C++ is old enough that its programmers can be categorized into several generations when it comes to which standard idioms and "best" practices they learned, and finally because (again due to its incredible hugeness) new techniques are constantly discovered and evolving (template meta programming, now a very important feature of C++, was an accident nobody had planned for), the C++ community's opinions on idioms and practices isn't as compact as, say, the Java community's, and can hardly be communicated as a set of a few dozen rules without arousing heated discussions.
(I think the fact that there are several different very good and recommended Best Practices books listing several dozen rules of thumb each, and the fact that some of them managed to later acquire a supplementing More Best Practices book, literally speaks volumes about this.)
You will find many professional C++ programmers who happily use only 30% of what C++ offers. For example, many use it just as an OO language, missing out templates (maybe except for the STL), exceptions, and other very useful stuff. But C++ is a multi-paradigm language. It supports object-oriented programming as well as generic programming, generative programming, a lot of functional programming stuff, and quite a few other paradigms. And it becomes most powerful where those paradigms are combined.
So what's my advice?
Have a look at The Definitive C++ Book Guide and List.
First make your pick from the beginner's books. Since you say you already had exposure to C++, I'd recommend Accelerated C++ by Andrew Koenig and Barbara Moo. That's an excellent introduction which can't be praised enough for the way it changed teaching C++, but it comes with quite a steep learning curve. Also, with 250 pages, it's really just a short introduction.
An alternative to that would probably be either Stanley Lippman's C++ Primer (which, at 1000 pages, covers the same ground in detail) or Bruce Eckel's Thinking in C++ (which I don't know) or Bjarne Stroustrup's classic The C++ Programming Language (also 1k pages) or his newest book, Programming - Principles and Practice Using C++ (which I haven't looked at yet).
These books come with enough tasks to keep you busy for a while. Add a few of your own to that and you can be busy learning for months.
Then slowly work your way down the list.
The next C++ standard, now generally expected in 2011, will add a few challenging concepts to the language (like rvalue references) and a vastly expanded standard library. (The current draft has almost twice as many pages as the last one.) Unfortunately, since the standard isn't yet finished, there are no books available teaching it. It's all spread out in articles and in online discussions (although Wikipedia has a pretty good article about it), and it's all meant for fluent C++ programmers, not for C++ novices. There is, unfortunately, not a single text out there teaching C++1x to C++ newbies And I'm afraid it might take years before you can make your pick between several recommended books doing this.
And don't forget the C++ FAQ, which is a pretty good (and very readable) online collection of best practices (and their rationals), although it's by no means an introductory text.
-
-
2C++ is complex, yes, but why should "regular" C++ programmers be versed in e.g. template metaprogramming? Can you point out an example where template metaprogramming enables the developers to do something which is not possible by other means? For regular application development, one does not need to know the entirety of C++ standard. It is enough to know the pitfalls of the language (which, in itself, is quite a lot to fathom), and the current basic libraries used for the project. – Schedler Aug 13 '10 at 22:37
-
@Schedler: "Can you point out an example where template metaprogramming enables [...] to do something which is not possible by other means?" Executing algorithms at compile-time means that, if doesn't fail on the developer's machine, it won't fails on the customer's either. If you're making an app that's to be installed on several million different desktop machines, this can hardly be valued high enough and is worth almost any effort. Of course, this still doesn't mean everybody has to be able to do TMP. But if you're treating C++ as just an OO language, you're missing lot. C++ is a... – sbi Aug 14 '10 at 10:09
-
...multi-paradigm language and shines brightest where you mix the paradigms. (FWIW, you probably do this everyday when you store polymorphic classes in STL containers.) – sbi Aug 14 '10 at 10:09
-
Don't get me wrong, I know the complexity of C++ but when you don't use for a long time this languague you kinda lose the "C++ reasoning", that's why I was asking for specific examples. Anyway really good answer, I'll look into those books. – dierre Aug 14 '10 at 11:25
-
OMG, less than an unprofessional, anyway, it's never toooo late to learn and keep improving bit by bit – ladyfafa Aug 14 '10 at 22:09
There is no substitute for practice.
Find a program you want on your machine (maybe as simple as something that counts the number of lines in a project), and write it in C++.
I wish I could tell you that I have an awesome resource that shows you every C++ trick in the book, but truth be told, you are that resource.
Practice. Learn from your own mistakes. You are your best teacher.

- 14,033
- 6
- 51
- 68
-
And how does that advice differ from the site linked to in the question, which does exactly that, only it has already picked a set of examples which, presumably, were considered good for learning a language? – sbi Aug 13 '10 at 20:06
-
@sbi - As you mentioned in your answer, you are still learning new stuff every week. Is there a single site teaching you that stuff, or are you learning it because *you* want to learn it? Your post exemplifies my point -- you are your best teacher. – riwalk Aug 16 '10 at 15:45
-
1Nowadays I mostly learn through discussions and other people's answers in places like SO. – sbi Aug 16 '10 at 18:40
Sphere Online Judge looks like it will work with C++ (and a host of other languages as well). It is not as simple as CodingBat, but will have more complex problems.

- 1,387
- 2
- 12
- 12