Skip to main content

Section 1.2 Why C++?

The core goal of this book is to teach how to develop programs and work with data structures. Learning these skills in general requires learning a specific programming language in which to express your ideas. So why C++?
C++ is a general-purpose programming language that is used in a wide range of applications. It is used for systems programming, embedded systems, games, and other performance-critical applications. In addition to all the places C++ is used, its influence can be seen in many other popular programming languages, including Java and Rust.
We can also use C++ to explore multiple paradigms. While some languages force the programmer into a particular style of programming, C++ gives us the flexibility to switch between different styles. We can write a purely procedural program, an object oriented one, or even develop in a style that is largely functional.
More importantly, C++ allows us to think about problems at different abstraction levels. Unlike languages like Python or Java, which shield us from low-level details, C++ gives us the ability to "look under the hood." Although we do not always want to be exposed to all of those details, the ability to do so can be beneficial for understanding how code actually works. C++ gives us abstractions that can be used to manage complexity while still allowing us to understand the underlying mechanics.
Finally, C++ generally requires the programmer to make explicit choices. Instead of relying on the language to decide the answers to questions like "What type of data is stored here?" and "Does this function receive a copy of its parameters or a reference to them?", in C++ you must specify these things explicitly. Having the language manage such things can be convenient for a working developer. But while learning to program, it is useful to be forced to think about these questions and specify the answers to them.
We make no effort to exhaustively cover C++ or even all aspects of the features we do cover. A valid criticism of the language is that it tries to do too much and that using every feature it provides can lead to overly complex code. Instead, we focus on:
  • The C++ syntax required for concepts and techniques that are widely applicable across different programming languages.
  • C++ syntax and features that are required for β€œpeeking under the hood” and making important decisions about our how our code operates.
You have attempted of activities on this page.