Preface¶
There are many books available if you want to learn to program in C++. Does the C++ community really need yet another textbook? Apparently, I think the answer to that question is ‘yes’. Why?
Many excellent books are not appropriate for new language learners.
Many books, although excellent when written, have not been updated as the language has changed.
Significant language changes over the past 10 - 15 years justifies teaching new features and retiring old ones.
Many textbooks claiming to be ‘for C++’ are not much more than bare bones ports from other languages.
I take exception especially to this last group, as they claim to be C++ textbooks (and charge good money for it), however, they do not teach good idiomatic C++.
What do I mean by idiomatic C++?
In a nutshell, it means writing C++ code that follows the conventions of the language. Because C++ is a language that has undergone significant change since its inception, the C++ of 1998 is not the C++ of today. Perhaps a short story would help make the point more clearly:
While most C++ textbooks that have been marginally ported from other languages cannot hope to achieve the level of silliness reached by English As She Is Spoke, they still fail their readers. That is, they fail to teach C++ as C++. C++ is not C, Python, Java, Visual Basic, or anything else.
Good, idiomatic, C++ embodies the philosophy behind the C++ Core Guidelines[2], the first few of which are:
Ideas are expressed in code
Code in ISO Standard C++
Prefer compile-time checking to run-time checking
The goal of this book is to describe the current version of the language in a clear, concise style, supplemented by meaningful activities where appropriate. This book is expressly written for students in my course. Others may also find it useful.
The goal of this book is not to describe every language feature in C++. Why? Primarily because C++ is a large language, but also because you don’t need to know all of C++ to be an effective C++ programmer. If you really want to read about every language feature, then read cppreference.com.
Programming is not a “spectator sport”. It is something you do, something you participate in. It would make sense, then, that the book you use to learn programming should allow you to be active.
This book is meant to provide you with an interactive experience as you learn to program. You can read the text, watch videos, and write and execute code. In addition to simply executing code, there are visualizations which allow you to control the flow of execution, and watch variables as they are created and destroyed, in order to gain a better understanding of how the program works.
Different presentation techniques are used where appropriate. In other words, sometimes it might be best to read a description of some aspect of a programming language. On a different occasion, it might be best to execute a small example program. An important goal is to provide multiple options for covering the material in each section. Hopefully, you will find your understanding is enhanced because you are able to experience content in more than just one way.
How to Contribute¶
Readers are encouraged to fork the source repository for this book on GitHub. Improve it and submit a pull request. The document GitHub-Forking is an excellent place to get started. Read this first.
Every pull request will be evaluated for inclusion and if not included, I will let you know why.