324 points · by vinny12 · 9y ago · 104 comments
It's the worst programming book I have ever read! It's introduction made me hate C++ and if I didn't had to work with other C++ libraries, I would have avoided C++. The text is full of bloat, for the lack of better word. It's the opposite of crisp writing.
I read some good language books like K&R's C, Joe Armstrong's Erlang book. I loved them and I thought this would be in same league. It's not.
I would like to learn C++ systematically, like not cut-and-paste stuff. "How to think like a computer scientist: C++" seems like a good book. I read the book "How to think like a computer scientist", which is an introduction to programming in Python. I think that would be a good start. Is it a good book for experienced programmers wanting to learn C++?
To people wanting to learn C++, please avoid Stoustrop's book like Plague.
EDIT: I read "The C++ programming language 4th edition" which explains C++11 https://en.wikipedia.org/wiki/The_C%2B%2B_Programming_Langua...
You may find his book "Principles and Practice Using C++" [1] more accessible.
You nailed it with that analogy though.
K&R is a "first book" and important historically, but right now it's an atrocious book if you want to learn current C and this has been the case for a long, long time.
Sometimes these first books don't withstand the test of time.
K&R may be archaic now, even obsolete. However, for decades it has was held up as a an example of what a good technical/language book could be. You don't have to agree with the assessment to agree with the fact - that this was touted as a very good technical book for various reasons.
There never was a "K&R" of C++. That's not unusual, many languages are in the same boat. If you want to go back to the "firsts" it would be a combination of The C++ Primer and Strousoup, putting them together gave you something that was both more and less that K&R was for C.
From the software engineering point of view, almost every single code example is terrible. Abundant implicit casts depending on the OS, loops that leak buffered reading between iterations, etc etc.
Just no. Never, ever recommend K&R to anybody as a general programming book neither for C or in general. Only the intro descriptions of language characteristics and important functions of the standard library are any use, and then again even these are extremely obsolete now.
Strongly disagree.
Not to be confused with C++ Primer Plus.
One drawback may be it's age; it's 17 years old. On the other hand it was way ahead of it's time and good writing doesn't get old.
(ps. I quite like Stroustrup's books but to each their own)
[0] https://en.wikipedia.org/wiki/Open-source_license
[1] https://theboostcpplibraries.com/
[2] http://greenteapress.com/thinkcpp/index.html
[3] http://opendatastructures.org/ods-cpp/About_this_document.html
[4] http://www.network-theory.co.uk/about.htmlAnother important thing, no matter how many books you read, you can't be a master without actually solving a lot of problems.
Questions from learners are often poorly formulated and then poorly answered. Since many people are just looking for getting their code to run or finishing their homework, this sort of stuff just piles up without getting fixed.
If you're trying to learn anything non-trivial, don't rely on SO alone.
On the other hand, people like Scott Meyers have spent their lifetime and careers explaining its intricacies, without solving any real problems.
It can be misleading to think of standard header code (especially template code) as "idiomatic C++". It'd be better described as "idiomatic standard-library-implementor C++", since the folks implementing stuff in std are operating under a whole set of constraints that don't affect ordinary C++ programmers. Arbitrary user-defined symbols that could be in scope, user-provided types that could have overloaded operator-comma, etc.
Designers and implementors are traditionally under a very different set of constraints than "average users" (who in this case are programmers), though their goals do align. But this leads to very different set of assumptions, optimizations, and tools being available. Things that would generally be overkill are suddenly very viable and worthwhile goals to achieve (e.g. micro-optimizations add up repeatedly so they're very worth it, vendoring is much more useful to control dependencies/scope of bugs), and vice versa.
So I wouldn't be extremely miffed if you look at libstdc++ or libcxx or <whatever> and find it somewhat unkempt or gross compared to average code. It's often very much not-average. In fact it's likely given careful understanding of the constraints that code exists under -- you'd come up with similar results.
And what's with the Scott Meyers ding? I think of him mostly as an educator and in that respect he's very accomplished.
Each time I hear a discussion between programmers, it is always these arguments of whether build tool A is better than build tool B, or whether VCS A suits their workflow better than VCS B, or how cool is the latest language feature. I never see programmers discussing the merits of their solutions, regardless of the language or environment.
Sometimes people think they know their favorite language, but most would fail a language puzzle quiz.
Right, I'm sure Go is the one and only language out there without a single pitfall or quirk.
But that is especially true for C++. People who are confident in knowing it often lack the fundamental C knowledge (i.e. pointer arithmetic, the complete C type system, the subtle conversion and promotion rules, etc.), but would insist on knowing C++ very well just because they know how to define classes, virtual functions and throw a shared_ptr or a vector or a map at every problem.
It's such a complex language brimming with idiosyncrasies that I'd be inclined to really test anyone claiming to be a master. The standard is one thing, then there's the compiler you're using...
Also a programming language is not used alone and C++ standard library is quite tiny when compared to Java's standard library.
And it's under active revision and improvement. There are great new things to learn every few years.
And to be frank: I'd say that anyone opposed to continue to learn new things is entirely in the wrong field if he/she works on any technology-related job.
You don't keep learn new stuff because C++ is super, uber, powerful. It is because it is not designed well and there are far too many dark corners.
Have anyone read it and know how it compares to the books recommended in this article?
http://cglab.ca/~morin/teaching/5408/ https://github.com/patmorin/tds
- Build a time machine
- Go back to 1988 and get hold of Bjarne's first book and a Zortech compiler
- Grow old, tinkering with and constantly keeping tabs on the language's evolution.
In this way, what seems to the modern neophyte like a massive indigestible meal is actually presented as a procession of smaller courses, most of which are an improvement on the ones preceding.
Open source at: https://github.com/jeremyhansen/rooksguide-cplusplus
Previously discussed at https://news.ycombinator.com/item?id=6806598
Full disclosure: I joined as a technical editor on the kickstarter just before publication.
I thought Eckel's book was especially good for someone who already had a background in C.
I have one question though, Is there any pdf version for "The Boost C++ Libraries"? I really need it.
Theres a lot of good stuff in there..
Just get: src/base, src/ipc, src/net (and something else you are interested in) and you are good to go
https://www.chromium.org/developers
Then, if you need more, you will have to do it the "hacker way", by reading the chromium source code.
But hey.. you are a C++ dev, source code should be your stack overflow, and primary source of "documentation".
hint: The unit test files, can make the "how to use this" much more obvious
Also it can break any time.
Now, if you want more functionality than that.. like access to the last blink/webkit api, than you will suffer a little bit.
C+ - No idea.
C++ - C with a bunch of stuff added on (mainly OO, other goodies too). Still no GC.
C# - not related to C at all. It's basically Microsoft's Java, with GC, OO, higher level constructs, lots of sugar, etc...
Both Rust and Go (big in China) are worth looking at. Unless you're doing games programming C++ is neither C/ASM (which is popular for hardware) nor Java/C# (popular for business software) or PHP/RoR/Java (popular for web back ends).
Plus when you learn C++ you don't have to learn one language, it is more like learning four or five as they completely re-invented the language every time a standard ships. This might sound good, except a lot of these constructs are a pain in the butt to intermingle.
Furthermore, I'm not just talking about the existence of a standard, but the complexity of the standard (C++is v. big), and also how much that standard restricts, and hence results in conformal, predictable code.
You mean C++03, C++11, C++14, C++17? Or something else?
If you mean those, I fail to see the problem. The language isn't dead, so it's not static, and it evolves over time. Publishing a new standard every few years is the only way to keep all compilers aligned, rather than each going off in its own "with extra features!" direction.