Live data from Hacker News

Ask HN: Best way to learn modern C++?

news.ycombinator.com

51–60 of 184 posts

Re: Ask HN: Best way to learn modern C++?

#51
post #42

Do you mind asking 'Why C++'? I know that doesn't answer your question and to be honest, I am curious about the resources which come up here too, but C++ can be so painful to learn that I wanted to know what drives you into that direction. I mean, there are alternatives like Rust. Do you have a specific project in mind, need it to fulfill some résumé requirements or something completely different?

I find this comment a bit odd... Not everyone works at a startup and 90% of development work is improving existing codebases, not starting new projects. There's just SO MANY existing C++ codebases out there that people are paid to work on. I had to (re)learn C++ for a project at work recently.

Re: Ask HN: Best way to learn modern C++?

#52
post #50
post #18

Use it. Not being a smart@$$ here. Any language you want to learn will only become natural when you've used it for a significant project or set of exercises. Either clone or port something non trivial, or use it for your latest pet project, or get permission to use it at work.

I'd still argue that there's a lot of value in some form of teaching (via book or video or whatever). If left to their own devices, novices will often come up with messy, non-idiomatic ways to do things.

I find using both in combination is usually the best way to go. If you're just reading a book and doing exercises in it, you wont learn as well. Making something you want to make and using books as reference while developing makes you learn a lot quicker.

Also, the answer to this question depends a lot on your previous experience with other languages. If you're well-versed in another C-like language, jumping right in and starting to make something will probably teach you a lot, really quickly. If you're more of a beginner in programming generally, you need a book or a teacher.

Re: Ask HN: Best way to learn modern C++?

#53
As others noted best way to learn is to use it. Pick any open source you like, compile and test it, learn it's code, try to fix some bugs or implement features, ask questions from other developers, get feedback on your code. That way you'll learn all caveats of practical C++ development and tools.

Additionally while traditional and more detailed books already posted here I'll just add one I personally liked: Discovering Modern C++ by Peter Gottschling. It's had exactly information I would expect be needed for person who already have reasonable experience in programming, but want short introduction into C++.

Disclaimer: I'm certainly not someone you can call experienced C++ programmer since I just developing and manage open source project for 3+ years. So take my opinion with a grain of salt.

Re: Ask HN: Best way to learn modern C++?

#54
post #34

Earlier quoted context omitted.

Languages rarely get replaced though. We are just adding to the pile.

Only in a very strict interpretation that everything that is still used somewhere didn't get replaced. Perl was more or less replaced, for example, and I like that. The only kind of originality that is good in programming is "surprisingly simple". "Surprisingly weird" is terrible.

You're going to get at least 1 angry Perl programmer explaining that Perl is actually thriving and it's never been better to be a Perl programmer :p

Which is actually partially true... the long tail of programming languages today is very, very big. There's probably 10-50x more programmers now than there were back in 1995. The programming world can probably sustain 10-20 mainstream languages these days, if not more.

Re: Ask HN: Best way to learn modern C++?

#55
If you know C, C++ Common Knowledge (https://www.amazon.com/Common-Knowledge-Essential-Intermedia...) will give you a quick run of the gotchas you're to avoid. From there, move to Scott Meyer's books, which will give you some good foundational knowledge on how features of the language work together. In particular I like that each concept is presented in a bite-sized chapter that you can read in a couple of hours and think about for the rest of the day. Even though the first two are about "classic C++" I wouldn't skip them. For a glimpse of the true power of modern C++, check the Boost Hana library docs, hopefully this will serve you as motivation to keep on going. Above all, don't do this alone. The compiler errors that you get once you start applying modern (template) techniques can be a bit of a rabbit hole and takes a bit to get an eye for deciphering them. Lean on coworkers, local user groups and/or the C++ slack group which is pretty supportive. Best of luck.

Re: Ask HN: Best way to learn modern C++?

#56
post #50
post #18

Use it. Not being a smart@$$ here. Any language you want to learn will only become natural when you've used it for a significant project or set of exercises. Either clone or port something non trivial, or use it for your latest pet project, or get permission to use it at work.

I'd still argue that there's a lot of value in some form of teaching (via book or video or whatever). If left to their own devices, novices will often come up with messy, non-idiomatic ways to do things.

Ya, I think a balanced approach is the best, begin by reaing or watching videos, but not too much, just to get an overall idea, then get hands on but don't stop there, read more code and watch more videos and continue the process for your life time!

I sometimes get carried away and stop reading more after I cross some threshold which prevented me from noticing lot of nice things like best practices that were happening in the industry/or better design patterns etc..

Re: Ask HN: Best way to learn modern C++?

#57
post #17

- Tour of C++ ( http://www.stroustrup.com/Tour.html ) - Principles and Practice Using C++ ( http://www.stroustrup.com/programming.html ) - From Mathematics to Generic Programming ( http://www.fm2gp.com/ ) - The Scott Meyers books Some of the Bjarne Stroustrup videos, "Learning and Teaching Modern C++" - https://www.youtube.com/watch?v=fX2W3nNjJIo Some of the Herb Sutter videos, "Writing Good C++14... By Default" - ht…

Abseil C++ Tips of the Week are also really good: https://abseil.io/tips/

Re: Ask HN: Best way to learn modern C++?

#58
post #18

Use it. Not being a smart@$$ here. Any language you want to learn will only become natural when you've used it for a significant project or set of exercises. Either clone or port something non trivial, or use it for your latest pet project, or get permission to use it at work.

That's a pretty useless answer. It's easy to use C++, but in a non-idiomatic or C-style way. I think the OP is aware of this problem and is looking for concrete examples of modern C++.

Re: Ask HN: Best way to learn modern C++?

#59
post #18

Use it. Not being a smart@$$ here. Any language you want to learn will only become natural when you've used it for a significant project or set of exercises. Either clone or port something non trivial, or use it for your latest pet project, or get permission to use it at work.

The best advice that was given to me in college on how to learn a new programming language was to use it.

[deleted]

Re: Ask HN: Best way to learn modern C++?

#60
If you haven't already I'd suggest learning a functional language first, then coming back to modern C++, because much of the new features are borrowed from other languages.

Personally I started doing this then never went back. Seems most of the jobs out there for C++ really aren't that interesting.

Post reply on HN