Live data from Hacker News

On Writing a C++ Book

lospi.net

21–30 of 44 posts

Re: On Writing a C++ Book

#22
post #6

> C++ has a daunting reputation because its fundamental elements nest so tightly together Do they? I tend to find that C++’s features are often quite disjoint, which means that you can pick-and-choose which bits you want to use but the language isn’t quite designed like a coherent whole as some other languages are.

Any language that grows big has that problem. My favourite example is Python, I started using it with version 1.6 and even though I only use it for small scripting tasks, always followed each release since then. It might appeal to beginners, but underneath lies a language as powerful as C++, where even the most savy will fail to remember what changed between minor releases.

> Any language that grows big has that problem.

I'm also quite sure that we will see similar issues with other languages in the coming decades, with new paradigms becoming popular and existing languages trying to retrofit those in their design. C++ is one of the oldest and biggest (in term of usage) language that is still used for new projects and evolving, the competition is one or two decades younger, they still have plenty of time to evolve into monsters.

Re: On Writing a C++ Book

#23
post #19

What would be the modern (14/17/20) C++ as the first language book nowadays?

I'm not sure I understand your question, but if you are asking for a first book to learn the language, adapted to modern C++, then "A tour of C++" by Bjarne Stroustrup (initial creator of the language) is a really good one: http://www.stroustrup.com/tour2.html.

It's relatively short (~250 pages) and simple to start with. And the second edition is updated to C++17, and covers a bit of C++20.

Re: On Writing a C++ Book

#24
post #20
post #8

Earlier quoted context omitted.

Do you mean A Tour of C++? That's an excellent introduction by Bjarne himself, but does not talk about some things such as the Boost library.

A tour of C++, by B. Stroustrup. Short (~250pages) and accessible introduction to the language and libraries. The second edition has been updated for C++17 and some parts of C++20. Amazon link: https://www.amazon.com/Tour-2nd-Depth-Bjarne-Stroustrup/dp/0... C++ Primer, by Stanley B. Lippman, Josée Lajoie, and arbara E. Moo. Really huge book, 970+ pages. Covers almost everything from the language, updated for C++11. I…

Primer is a really dry reference. It was too boring for me to read it in order. Too many details on not very fun topics from the beginning.

Re: On Writing a C++ Book

#25

Did I miss or there isn't a section that covers modern build systems? I would have loved to get an intro to that.

Same here, I would really like to read a good write-up on this topic. I started to write blog articles on CMake a few months ago while learning to use it but never published them as they became way too huge and messy. I would be definitely interested in an equivalent of "A tour of C++" but for modern-ish build systems, by someone with better writing skills than I have :-)

Re: On Writing a C++ Book

#26
post #22
post #6

Earlier quoted context omitted.

Any language that grows big has that problem. My favourite example is Python, I started using it with version 1.6 and even though I only use it for small scripting tasks, always followed each release since then. It might appeal to beginners, but underneath lies a language as powerful as C++, where even the most savy will fail to remember what changed between minor releases.

> Any language that grows big has that problem. I'm also quite sure that we will see similar issues with other languages in the coming decades, with new paradigms becoming popular and existing languages trying to retrofit those in their design. C++ is one of the oldest and biggest (in term of usage) language that is still used for new projects and evolving, the competition is one or two decades younger, they still ha…

Have you ever tried to answer C, Python, Perl, Java, C#, F#, VB.NET, OCaml, Haskell, JavaScript Quiz Pub questions?

Many think that they know what they are using, but never bothered to actually read the language reference manual.

Re: On Writing a C++ Book

#28
post #19

What would be the modern (14/17/20) C++ as the first language book nowadays?

Everyone has a different path, but frankly, I wouldn't recommend C++ as a first programming language. It's much easier to comprehend if you have some background in another language.

My three favorite C++ books are C++ Common Knowledge, Modern Effective C++, and Effective C++. Two of those predate C++11, but most of the advice is still applicable.

As for introductory texts, I guess there's: Accelerated C++, C++ Primer, Discovering Modern C++, A Tour of C++, and of course C++ Crash Course (the book under discussion).

I wouldn't get too hung up on "modern" C++. The vast majority of C++ programmers learned the old stuff (the vast majority of which is still valid), then caught up on the new stuff with Effective Modern C++, blog posts, etc. Just as it's useful to know C before you learn C++, it's useful to know old C++ before you learn modern C++.

Re: On Writing a C++ Book

#29
post #6

> C++ has a daunting reputation because its fundamental elements nest so tightly together Do they? I tend to find that C++’s features are often quite disjoint, which means that you can pick-and-choose which bits you want to use but the language isn’t quite designed like a coherent whole as some other languages are.

Any language that grows big has that problem. My favourite example is Python, I started using it with version 1.6 and even though I only use it for small scripting tasks, always followed each release since then. It might appeal to beginners, but underneath lies a language as powerful as C++, where even the most savy will fail to remember what changed between minor releases.

As much as a like python, it is not as powerful as c++. Hence the reason you have to use cython/cpython to improve performance.

Re: On Writing a C++ Book

#30
post #19

What would be the modern (14/17/20) C++ as the first language book nowadays?

Everyone has a different path, but frankly, I wouldn't recommend C++ as a first programming language. It's much easier to comprehend if you have some background in another language. My three favorite C++ books are C++ Common Knowledge , Modern Effective C++ , and Effective C++ . Two of those predate C++11, but most of the advice is still applicable. As for introductory texts, I guess there's: Accelerated C++ , C++ Pr…

> Just as it's useful to know C before you learn C++, it's useful to know old C++ before you learn modern C++.

There are definitely varying opinions on this. If you look for C++ courses for beginners they mostly do not start with C these days. I'd be surprised if any courses currently being taught don't start with lots of std library stuff (especially vector, string, map, etc...).

Post reply on HN