Last week, I launched a quiz. The price was it to win one of the five vouchers for the book "Modern C++ for Absolute Beginners" from Slobodan Dmitrović.
Your challenge was it to answer the following questions:
- What was your greatest challenge when learning C++? If you could turn back time, what would you do differently now?
- What advice would you give to beginners in C++?
Before I present - in our opinion - the five best answers, I want to say thanks to the more than 20 participants providing very interesting answers. Each one had a different perspective. To make it short, here are the five winners.
- Nico Liberato Candio
- Ivica Bogosavljevic
- Gabriel Valenzuela
- Dominik Cubelic
- Dietmar Schulz
I will send your e-mail addresses to apress , and they will contact you.
Here are the quoted answers. I fixed a few typos.
What was your greatest challenge when learning C++? If you could turn back time, what would you do differently now?
Nico Liberato Candio
One of the major challenges learning C++, in my opinion, is to overcome the “fear” of the language itself; back in the years I remember that were substantially absent in the literature books or resources to make the language generally accessible and simple to learn. The books of C++ ( except the good book Tour of C++, from Bjarne) are complex and too advanced and detailed for an absolute beginner.
Turning back in the time I would prioritize simple and accessible ways to learn the language, through a practical approach (hackerrank videos + exercises, resources absent at the time, Udacity so on ). I would probably focus more on the fundamentals in a practical way (I/O, Classes and OOP, strings, STL, so forth) and then start to grab the more advanced topics (templates, lambdas, so on).
Templates without a doubt. I work as a performance engineer, and templates are an indispensable part of that. You can have several versions of the same function where each is optimized for a specific case without any code duplication. I can make fast polymorphic code at compile-time by having a separate container for each type and templates allow me to have several functions for each of them.
If I could go back in time, I would definitely learn templates better. Variadic templates, recursive functions with templates at compile time etc. I wrote a custom array container for polymorphic objects that using variadic templates that is faster than anything available in STL (I can provide the link if you would like to see it).
For me, the greatest challenge is understanding memory management. C++ derives from C, one of the first programming languages that make an abstraction of Assembler. C came to help the memory management using the functions calloc(),malloc() and free(), with this base and introducing the Object Oriented Paradigm (OOP) cames C++, following the line of C and introducing the new features that the modernity make available.
When I learned C++ for the first time, it was in my college, 1st year of engineering and there are a lot of things that I would do differently. Learn more about new standards, learn more about compilers and have a better understanding of what means a compiled language, learn smart pointers, and see why they are more efficient than raw pointers between other topics.
As I just started learning C++ my biggest challenge is actually finding resources that are good and actually still valid and up to date, and differentiating all the mixed information I am getting.
If I could turn back time I would definitely make myself learn C++ earlier.
The introduction of .NET and C# made me very lucky. I damned C++ and really thought that C# and .NET would solve the issues with C++ about dangling pointers and memory leaks. Tools like boundchecker and bugtrapper will no more be necessary.
--> What a nonsense! Of course, the development with C# got faster and we also fell faster in the known tracks of cyclic references, also null references.
And then, because of sheltering our intellectual property we still had to use C++ for these modules. The binding parts between C# and C++ were then implemented in Microsoft's managed C++ ... Frustrating.
What advice would you give to beginners in C++?
Nico Liberato Candio
Prioritize the practical approach, starting from the basics: follow a schedule based on 50% of the time spent on the theory ( learn I/O for example ) and then apply the theory with practical exercises.
C++ is tough. Language is complex, there are a lot of quirks to learn. But exactly for that reason, it is both fast and powerful. So don't worry, you'll get a grip on the most common things quickly, and you will learn other things when the time comes.
Be patient. Learning C++ can be like climbing a mountain, the finish line seems to be so far and unreachable, but step by step (However small it may be) we are a little close to finishing our path. And other advice, having a mistake doesn't mean that one fails, even better, it learns more about our mistakes than our success.
Well, as I am a beginner myself, the advice I feel work best are: read a lot, and code code code.
Do not start with plain C and port that to C++, use the STL and other libraries as much as possible instead of developing container yourself. In the usage of pointers be always aware of ownership! Always also look at the warnings your compiler emits in release mode, there can be very important hints that you don't get in debug builds!
Once more. Thanks a lot for your great answers.
Thanks a lot to my Patreon Supporters: Matt Braun, Roman Postanciuc, Tobias Zindl, G Prvulovic, Reinhold Dröge, Abernitzke, Frank Grimm, Sakib, Broeserl, António Pina, Sergey Agafyin, Андрей Бурмистров, Jake, GS, Lawton Shoemake, Animus24, Jozo Leko, John Breland, Venkat Nandam, Jose Francisco, Douglas Tinkham, Kuchlong Kuchlong, Robert Blanch, Truels Wissneth, Kris Kafka, Mario Luoni, Friedrich Huber, lennonli, Pramod Tikare Muralidhara, Peter Ware, Daniel Hufschläger, Alessandro Pezzato, Bob Perry, Satish Vangipuram, Andi Ireland, Richard Ohnemus, Michael Dunsky, Leo Goodstadt, John Wiederhirn, Yacob Cohen-Arazi, Florian Tischler, Robin Furness, Michael Young, Holger Detering, Bernd Mühlhaus, Matthieu Bolt, Stephen Kelley, Kyle Dean, Tusar Palauri, Dmitry Farberov, Juan Dent, George Liao, Daniel Ceperley, Jon T Hess, Stephen Totten, Wolfgang Fütterer, Matthias Grün, Phillip Diekmann, Ben Atakora, Ann Shatoff, Dominik Vošček, and Rob North.
Thanks, in particular, to Jon Hess, Lakshman, Christian Wittenhorst, Sherhy Pyton, Dendi Suhubdy, Sudhakar Belagurusamy, Richard Sargeant, Rusty Fleming, John Nebel, Mipko, Alicja Kaminska, and Slavko Radman.
My special thanks to Embarcadero
My special thanks to PVS-Studio
My special thanks to Tipi.build
I'm happy to give online seminars or face-to-face seminars worldwide. Please call me if you have any questions.
Standard Seminars (English/German)
Here is a compilation of my standard seminars. These seminars are only meant to give you a first orientation.
- C++ - The Core Language
- C++ - The Standard Library
- C++ - Compact
- C++11 and C++14
- Concurrency with Modern C++
- Design Pattern and Architectural Pattern with C++
- Embedded Programming with Modern C++
- Generic Programming (Templates) with C++
- Clean Code with Modern C++
- Phone: +49 7472 917441
- Mobil:: +49 176 5506 5086
- German Seminar Page: www.ModernesCpp.de
- Mentoring Page: www.ModernesCpp.org