4 ms·
What would be the best learning path to take for young people wanting to learn C++ today, especially with a focus on free software? Thanks for your attention!
by softwarelimits 9y ago
What would be the best learning path to take for young people wanting to learn C++ today, especially with a focus on free software? Thanks for your attention!
- codebeaker 9y agoExcellent question, and one for which I've not found a satisfactory answer. Perhaps some of the HN wisends can chime in. I believe with some linters (clang, etc) you can encourage your tools to slap your wrists if you code in a bad style using outdated techniques.
- Cieplak 9y agoFirst decide if it's really something worth your time. Then, spend several years playing with the std lib and maybe dabble with Boost. Read stackoverflow threads tagged with [c++] sorting by vote count descending. Read the tests in popular github c++ projects. Read A Tour of C++. Most importantly, write and rewrite lots of code, test it, debug it, and try out cool ideas you think of. If you get stuck, context shift to another task where you're not spinning your wheels.
- pjmlp 9y agoFirst of all, and most important one, learn C++ idioms, not C. This means making use of library types for memory allocation, vectors and strings. There is a place for old C style low level features, but those should come later, after the safer concepts are already ingrained. Kate Gregory's “Stop Teaching C" talk at CppCon 2015 explains better than me. https://www.youtube.com/watch?v=YnWhqhNdYyk https://www.youtube.com/watch?v=YnWhqhNdYyk Get a nice IDE, QtCreator, Clion, VC++ Community, KDevelop, XCode. Besides the "Tour of C++", check Stephan T. Lavavej talks at Channel 9. "Core C++ Lectures" https://channel9.msdn.com/Series/C9-Lectures-Stephan-T-Lavavej-Core-C- https://channel9.msdn.com/Series/C9-Lectures-Stephan-T-Lavav... "Advanced STL", these ones only when you already have a good understanding of STL as user https://channel9.msdn.com/Series/C9-Lectures-Stephan-T-Lavavej-Advanced-STL https://channel9.msdn.com/Series/C9-Lectures-Stephan-T-Lavav... Also check video presentations from NDC, ACCU, CppCon, CppNow and C9 Going Native.
- microcolonel 9y agoI agree with you for everything except this one statement: > First of all, and most important one, learn C++ idioms, not C. I think it would be better to learn both. C programming really has its place, and it gives you a model to understand how the sausage is really made. I know lots of C++ programmers who couldn't even begin to understand how half the things in their language work, this leads to completely needless performance loss (like using vectors for statically-sized arrays of data, which I recently replaced with a C array in a piece of game modelling software for a 20-30% improvement in runtime). The fact that you consider this the most important one is outlandish. I think it's easily more important to teach the tradeoffs and models involved in things like unique_ptr, rather than creating a cargo cult for abstractions that turn out to be useless half the time. C++ programmers really need to learn C, at least after their first year of blissful ignorance. Don't stop teaching C.
- pjmlp 9y agoSorry, but on this one given my comments history, I am with Kate Gregory. C style code has only one place, unsafe C++ coding for optimization purposes, only after validated through the use of a profiler. In 99% of the applications it is usually irrelevant for what the users are expecting, and there are even some nice talks at Nokia Wrocław conferences, where the presenter was able to generate better compacter code with modern C++ instead of classical C code. It was the C mentality brought into C++, back when learning C before C++ was the only path as C compilers were adding C++ support, that brought the daily CVEs we nowadays endure in such codebases.
- johannes1234321 9y agoThe previous poster wrote in his 3rd paragraph "There is a place for old C style low level features, but those should come later, after the safer concepts are already ingrained." And I agree that teaching idiomatic C++ is important and C stuff is an extension. If replacing vector with a C array gives you 20-30% my general assumption is that vector was used wrongly and there were too many copies happening and passing a pointer around avoided them. And yes, when teaching pure C++ students will also easily create too many copies, but that's better than all the buffer overflows, null pointer dereferences etc. happening to students of C. Such bugs cause frustration, but students need results which give satisfaction.
- mhh__ 9y agoRead lots of Scott Meyers and force yourself to read STL code. Bjarnes books are good but a bit pricey so I'd avoid paying for them.