Settings

Theme

On Writing a C++ Book

lospi.net

126 points by jalospinoso 7 years ago · 43 comments

Reader

satysin 7 years ago

C++ isn't my favourite language but it does have a special place in my heart. It wasn't the first programming language I learnt (that was Visual Basic) but it was the first language I did something serious with that was used by other people.

It has been a few years since I did any C++. I looked into it when C++11 came out and it was very much like a new language with foundations of the old language I both loved and hated. Since then I haven't had a need to use it. However I have a few little side projects I want to work on and C++ would be a fine choice for most of them so perhaps I will sit down sometime and get myself acquainted with the newer standards.

Side note: I was gifted a copy of Professional C++ by Gregoire a few months ago so if anyone reading this has read the 4th edition it would be nice to know if this is a good book to get myself up to speed again or if I should look elsewhere :)

filereaper 7 years ago

Once you've become familiar with the basics of the language, I highly recommend taking a look at C++ Core Guidelines

https://github.com/isocpp/CppCoreGuidelines

timClicks 7 years ago

Wow, well done! Will pick this up once Rust in Action is finished.

"It took twice as long to write half of what I proposed. I began writing a projects-based C++ book with a short introduction to the language." Well done for pushing through. It's really easy to become totally discouraged.

ausjke 7 years ago

is this out? No Starch still shows "early access" and "be ready in September", amazon showed it will be released on September 10, 2019. The TOC looks good to me. I hope it has a sample chapter.

  • 01100011 7 years ago

    I'd love to see a preview. At 792 pages, this seems rather long for a crash course.

  • dustfinger 7 years ago

    >I’m also beyond elated that it’s getting published

    I took that to mean that it is now in the process of being published.

    • jalospinosoOP 7 years ago

      Yes! Going through production/printing rites now. No firm date yet, I'm guessing low numbers of weeks.

  • flipper65 7 years ago

    I was able to order and download the beta ebook from No Starch this morning by following the link on his site.

bayesian_horse 7 years ago

Sounds promising.

I used C++ somewhat, almost 20 years ago, before discovering Python, but I never got very good at it. Over the years I wanted to strengthen my C++ skills, but I never found quite the right material or avenue. Most books/tutorials are too basic for me, others already assume a certain familiarity with C or C++. Maybe this book is better...

saagarjha 7 years ago

> 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.

  • pjmlp 7 years ago

    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.

    • dgellow 7 years ago

      > 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.

      • pjmlp 7 years ago

        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.

    • shaklee3 7 years ago

      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.

      • LBarret 7 years ago

        Powerful doesn't mean fast. Python is quite slow but C++ is not powerful enough to make so many things usable without -comparatively- a lot of work.

        C++ is very fast and entrenched in a few markets ( gamedev, trading, etc) but that's it. As a language it is quite average, encumbered by too many features, too many corner cases.

      • pjmlp 7 years ago

        I was speaking about grammar and language semantics, not implementation.

  • pjc50 7 years ago

    Unfortunately you can't feature-flag them off, and especially you can't automatically ban people from using all sorts of old unsafe constructs in your language, so for practical multi-contributor projects you have to be aware of all the features.

  • bayesian_horse 7 years ago

    It's not a coherent language because there are so many different compilers in use today.

    Many more modern Languages like Java, Python, Rust and Go have practically only one compiler/reference implementation and a couple of much less popular ones.

    • makapuf 7 years ago

      If we're talking about the language, we're talking about the standard, of which there is only one. Having many different compilers (and legacy code!) can indeed render the process of standardization hard (but needed), and legacy code can cause certain features not to be deprecated, but having several compilers do not render the language coherent or not.

      • bayesian_horse 7 years ago

        Hm, with "the language" I meant "as used". And standard-compliance does vary somewhat. On top of the compilers, there different sub-populations of programmers, being trained on different standards, different libraries, different sets of features.

        I'm not a proficient C++ programmer, but it appeared to me that there aren't that many programmers who know or even use the complete standard?

lone_haxx0r 7 years ago

Interesting that the author didn't include C++ Primer in his list of favorites. It's not perfect, but I think its latest edition (C++11) is a pretty good way to learn C++ currently.

  • copperx 7 years ago

    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.

    • dgellow 7 years ago

      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 wouldn't use it as a beginner though.

      Amazon link: https://www.amazon.com/C-Primer-Stanley-B-Lippman-ebook-dp-B...

      The first one is really nice introduction, I picked it up a few months ago to learn the language. Quick read, simple to follow, I really enjoy this book. The second one works as a reference as it goes way more in details and covers a massive amount of stuff!

      • reflexer 7 years ago

        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.

    • muterad_murilax 7 years ago

      OP is clearly talking about Stanley B. Lippman's book C++ Primer (Fifth Edition).

tasubotadas 7 years ago

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

  • reacharavindh 7 years ago

    I was also thinking the same thing after glancing at the table of contents. I remember working with C++ while studying at grad school with instructions by two professors who quite loved the language. Even though I enjoyed the language and its STL very much, the mess of its build system and linking to other libraries is what comes to my mind whenever I think about C++. This is exactly why I never touched it again.

    Cargo does a fantastic job for Rust in this regard. Rust won me over.

    • tasubotadas 7 years ago

      >Cargo does a fantastic job for Rust in this regard. Rust won me over.

      Cargo - that's exactly what I would love to have in C++. Probably there is something that I am just not aware of as I do not do a professional cpp development.

  • dgellow 7 years ago

    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 :-)

  • chengiz 7 years ago

    What does that have to do with C++?

    • aktenlage 7 years ago

      Isn't that obvious? Those who do serious C++ development typically need a good build system.

rememberlenny 7 years ago

As a dabbler in hardware and edge deployed machine learning models, this is exactly what I’ve been looking for.

la_barba 7 years ago

Which version of the C++ standard is this book targeting? Also, any links to reviews?

zerr 7 years ago

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

  • SloopJon 7 years ago

    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++.

    • criddell 7 years ago

      > 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...).

  • dgellow 7 years ago

    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.

  • tdsamardzhiev 7 years ago

    You mean, what's a good book for somebody who wants to learn programming with C++ as a language of choice?

    I'd vote for "Beginning Game Programming in C++" as a self-study book, and "Programming: Principles and Practices Using C++" if you have somebody more experienced that can help you set your environment.

    • bigjew222 7 years ago

      Who is the author of your recommended "Beginning Game Programming in C++" book...? Sounds interesting.

      • tdsamardzhiev 7 years ago

        Oops, I meant "Beginning C++ Through Game Programming" by Michael Dawson. It's a no-nonsense beginner programming text, geared towards people who want to learn C++ in order to make games.

  • reflexer 7 years ago

    Use python.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection