Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Debunking C++ Myths
  • Table Of Contents Toc
  • Feedback & Rating feedback
Debunking C++ Myths

Debunking C++ Myths

By : Alexandru Bolboacă, Ferenc-Lajos Deák
close
close
Debunking C++ Myths

Debunking C++ Myths

By: Alexandru Bolboacă, Ferenc-Lajos Deák

Overview of this book

Think you know C++? Think again. For decades, C++ has been clouded by myths and misunderstandings—from its early design decisions to misconceptions that still linger today. Claims like "C++ is too hard to learn" or "C++ is obsolete" are often rooted in some truth, but they are outdated and fail to capture the language’s ongoing evolution and modern capabilities. Written by industry veterans with over 40 years of combined experience, this book uncovers the myths, exploring their origins and relevance in the context of today’s C++ landscape. It equips you with a deeper understanding of advanced features and best practices to elevate your projects. Each chapter tackles a specific misconception, shedding light on C++'s modern features, such as smart pointers, lambdas, and concurrency. You’ll learn practical strategies to navigate common challenges like code portability and compiler compatibility, as well as how to incorporate modern best practices into your C++ codebase to optimize performance and future-proof your projects. By the end of this book, you’ll have a comprehensive understanding of C++'s evolution, equipping you to make informed decisions and harness its powerful features to enhance your skills, coding practices, and projects.
Table of Contents (15 chapters)
close
close

The Kate Gregory method – don’t teach C

In a talk at CppCon 2015 (https://www.youtube.com/watch?v=YnWhqhNdYyk), Kate Gregory makes the point that C is not a prerequisite for learning C++ and that it’s actively harming the learning process to start by teaching printf, naked arrays, and char pointers on the first day of a beginner C++ course.

Instead, her proposal is to start with the objects available in STL. The string and vector classes are quite clear to beginners, and operator overloading is also a very natural way to use these objects. Beginners expect that "abcd" + "efg" will result in "abcdefg"; there’s no need to explain the intricacies of operator overloading so that they can write simple programs. Moreover, this approach completely avoids discussing destructors and memory cleanup.

She continues by arguing that teaching lambdas to beginners is also quite easy if you start with an example. Consider trying to find a value in a vector. A first approach would be using a for loop that you can skim over. The second method is using std::find. But what if we want to find an even value in a vector<int> instance? This introduces lambdas very naturally in the conversation, without a whole discussion on all the possible ways to write them.

With this method, she argues that beginners will be able to use existing libraries. They will have some gaps in their knowledge, and in the case of a course for programmers working on a specific code base, you might need to have a section that introduces them to reading specific idioms useful for their work. And if you want these programmers to become library creators, then you need a more advanced course that dives into the depths of memory management and optimizations possible with pointers.

My 15 years of experience training people in complex skills tell me that this teaching method is very good. A key thing in training is to understand your target audience and do your best to avoid the curse of knowledge – the fact that you don’t remember how it was not to know something you know very well today. This method caters to the beginner mind by providing fast wins and good progression and giving the learners the courage to write code. So, it’s definitely an improvement in the methods of learning C++.

However, this is not the only way to learn a language. It’s a structured way, yes, but exploration is an important part of learning. There’s a way to learn C++ through exploration that uses a method typically associated with Twitter clashes: Test Driven Development (TDD).

bookmark search playlist download font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY