Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
The C++ and programming books I recommend (bert-hubert.blogspot.com)
78 points by nkurz on Feb 23, 2014 | hide | past | favorite | 50 comments


Please don't touch "The C Programming Language" if you care about modern C++, as you will learn lots of idioms that are good in C, but the WRONG THING in C++.

Better learning path:

- A Tour of C++, Bjarne Stroustrup

- The C++ Programming Language, 4th Edition, Bjarne Stroustrup

- Programming: Principles and Practice Using C++, Bjarne Stroustrup

- The Design and Evolution of C++, Bjarne Stroustrup (how C compatibility got to influence C++'s design)

Additionally read everything you can from Andrei Alexandrescu and Scott Meyers.

Then maybe, read The C Programming Language.


The best introductory text to modern C++ is, in my opinion, Accelerated C++ by Moo and Koenig. It's concise and teaches the language instead of spending 6 chapters teaching fundamental algorithms (yet another broken linked list class!) or OO principles (which often results in terrible C++).


Is this the book that evolves a student-grading application over 300+ pages? If so, I honestly do not understand why people call this book concise.

If you know C already, the pace of the book is so slow that you'll lose interest.


It's more targeted at people who do not know C. Koenig argues that building on C knowledge to learn C++ is a bad idea. They discuss this in the preface of the book.


Though I also recommend this book, their example code teaches bad habits (such as assignment within conditionals and horrendous compound statements) which should be avoided in any sort of production code.


Do you have any examples? I just flipped through the book and couldn't find any. Accelerated C++ was my first ever programming book. It was quite a doozy to get through at the time, but I feel like I'm forever indebted to it. Koenig's attention to detail and ability to explain what the machine is actually doing and the consequences in your code is still unmatched as far as I can tell.


median = size % 2 == 0 ? (homework[mid] + homework[mid-1]) / 2 : homework[mid];

In my opinion the ternary operator is misused here when an if/else would have been clearer.


Well, you omitted the all important const qualifier which would be a decent reason to use the ternary operator.


I actually like using the ternary operator in this sort of assignment, so I only need to type the variable name once instead of 3 times. The only real problem in your example is that everything is in one line. It woulf be better to indent that and to add some extra parenthesis to make the precedence clearer.


Ah yeah, that is one beefy line of code. I can agree with that.


If you can handle some abstract theory, the design of the STL is put into a useful context by Stepanov's Elements of Programming.

Stroustrup's The Design and Evolution of C++ is another great "why" book, and I hope that Bjarne will decide to update it for C++11 or 14.

It's older, but reading Lippman's Inside the C++ Object Model is what finally made the language click for me.


+1 for Inside the C++ Object Model. Understanding the mechanics of abstractions like virtual methods (along with stack/heap, pointers, but those are less C++-specific) makes you much more confident in what your code is doing (and why you might do it that way).


A lot of the key C++ books in my library are outdated as far as C++11 or 14, but still are pretty valuable especially for legacy code bases. Here are a few good ones that I haven't seen mentioned elsewhere in the thread.

- Sutter's Exceptional C++ books

- Dewhurst's C++ Common Knowledge and C++ Gotchas are useful.

- Sutter/Alexandrescu's "C++ Coding Standards" is good, too.


I second many of the books, but in particular "Sutter/Alexandrescu's C++ Coding Standards" the "coding standards" is misleading, its more like a "Code Complete" for hardcore C++.


C++ FAQ Lite is not a book, but a great reference; this is useful the night before an interview. It's helpful. It certainly did help with my interview.

http://www.parashift.com/c++-faq/

A book I like is C++ Primer.

In any case, this list on SO is pretty cool. http://stackoverflow.com/questions/388242/the-definitive-c-b...


C++ FAQ Lite is actually the "lite" version of the C++ FAQs (http://www.amazon.com/FAQs-2nd-Edition-Marshall-Cline/dp/020...) which is great.


Cool! Do they have a more-up-to-date version of C++ FAQ? Lite gets update when needed.


No mention of C++ Primer? A rather thorough (if a bit overwhelming) introduction to the language. And it teaches idiomatic C++, not just C with classes.


Seconding the C++ Primer! I've been slowly working through it over the past year, and have found it to be outstanding.


This is what I recommend to all my friends who want to learn C++. It's a little terse on some of the more advanced concepts but gets the job done very well.


I'm a really big fan of Effective C++ and More Effective C++.

The syntax of a language is fairly easy to grasp, and I think the more important thing is to learn how people use the language, what are the pitfalls you're likely to encounter, and how to code around them. Essentially a "best practices" guide.

It's great that C++ has these books. With some other languages its not obvious what the "best practices" books are or there don't seem to be any.


C++ provides many more ways to shoot yourself in the foot than most other languages, so it is in more need of such books.

For coding in C#, Framework Design Guidelines[1] is an excellent book. I'd argue that with a little adjustment for conventions, it applies to Java too - and IMHO Java is in more need of the advice, as test-oriented code can lead to unwieldy, overcomplex APIs, a tendency that needs tempering.

[1] http://www.amazon.com/Framework-Design-Guidelines-Convention...


Java also has its share, specially with books like the Java Puzzles ones, which show some gotchas of the language.

I think that any language that reaches the enterprise mainstream, suffers from the "creativity" of enterprise architects.


Haha yeah I agree completely with that reasoning for why C++ gets two books on how to write C++ programs properly.

Maybe some languages would only need a pamphlet.


Yes, also Effective STL. These books turned me from a C++ coder into the "the C++ guy" at work.


> This book isn't about C++, but, everything relevant to C is also relevant to C++.

Wow, that's bad advice.


I haven't read Lakos' book sad to say.

Since it's a little old now, can anyone tell how well it still stands up today? Are there any rules/guidelines from the book that are outdated?


Lakos works at Bloomberg and his design principles from the book have been in use there for over a decade. The book content might seem strange for someone coding on their own, but when you have a staggering amount of C++, the order it brings to the chaos is welcome. If you wind up reading it you can see the concepts in practice in our GH repo (bloomberg/bde), which might make it an easier read.


Lakos is the most influential (to me) programming book I've ever read. It came out perfectly timed, as I was moving from lone coder to lead coder, and the videogames industry was growing from 1-2 coder teams into 5+ teams, from thousands to millions of LOC and from C to C++.


Modern compilers have made external (or "redundant") include guards unnecessary. http://c2.com/cgi/wiki?RedundantIncludeGuards


You forgot the best, and most informative, C++ reference:

http://yosefk.com/c++fqa/


Would it be counter productive to learn C++ using Stanford School of Engineering Introduction to Computer Science Programming Abstractions[1] CS106b considering it was taught in 2008?

[1]http://see.stanford.edu/see/courseinfo.aspx?coll=11f4f422-56...


I cannot judge on the quality of the course, but there are a lot of horrible C++ resources (including books) out there and over the years the community has come to a kind of consent which resources are likely produce C++ programmers which shouldn't be shot on sight.

http://stackoverflow.com/questions/388242/the-definitive-c-b... is probably the most comprehensive list right now.


I have been through few lectures and found it ok. Some people complain that it does not use standard library.


I am about to finish CS106a which is designed in similar fashion. It uses ACM libraries. It was my first programming course and I think I did great[1]. Mehran Sahami is a great teacher and he presented lectures in a very digestible fashion. Also assignments are designed in a very doable way. It all turned out to be a very pleasing experience. There is no end to learning so I will have to spend some time learning the main Java class.

It also only supports Mac(Xcode) and Windows(VB) but I would like to use something like Qt-Creator on Linux.

[1] https://github.com/donniezazen/Stanford-CS106a


I've been looking for a good book that teaches idiomatic C++11 programming from scratch. Something like Accelerated C++ or Programming: Principles and Practice Using C++ but using C++11/14 only. Lots of the C++11 books I've found have assumed you know C++98 and say what the differences are. Anyone have any suggestions?


The 4th edition of "The C++ Programming Language" has been updated to cover C++11. Contrary to the article I think the book is very well suited to learn C++ (although not to learn programming). It takes a bottom-up approach making it suitable for people that have no previous exposure to a similar language.


I just want a book about only c++11/14, that teach me how to grasp everything form scratch with best practices in mind.


I haven't read it yet, but Scott Meyers (Effective C++) has released a PDF that covers just the additions of C++11/14.

http://www.artima.com/shop/overview_of_the_new_cpp


Would you recommend that a novice programmer learn C++ these days? Just seems like the ROI is too little in terms of new concepts that'll be learned. I mostly suggest C -> Java/C# -> Some functional language and also Python/JS on the side.


I would. C++ is still really important for low level algorithms. One can always do some low level programming with Java or C#. But is not as effective when it's done with Java/C#.


I was asked this question,but could not come up with a good answer:Assuming someone has never programmed before,but has the (mis)fortune of using C++(e.g that is what the school he/she is enrolled in uses) what would be the best book to start with?


I like the C++ Primer (I actually prefer it to Stroudstrup) and this book does start from a basic example - describing what a function is.

I think that using the Primer to learn programming would be a hellish experience but then learning C++ as a first language is never going to be fun.


This is pretty far from an introductory C++ book, but I'd like to mention "Modern C++ Design" by Andrei Alexandrescu. Back when I was writing C++ code, this was the book that really opened my eyes to what you could do with the language.


Does anyone know of any books they would recommend about the new C++11 threading model?


I've read C++ Concurrency in Action and found it very helpful in understanding these concepts: http://www.manning.com/williams/



I like this book especially if you are new to programming: Jumping into C++


Thank you, I'm glad you like it :)


Thinking in C++ vol 1 & 2




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: