Before you keep reading...
Runestone Academy can only continue if we get support from individuals like you. As a student you are well aware of the high cost of textbooks. Our mission is to provide great books to you for free, but we ask that you consider a $10 donation, more if you can or less if $10 is a burden.
Before you keep reading...
Making great stuff takes time and $$. If you appreciate the book you are reading now and want to keep quality materials free for other students please consider a donation to Runestone Academy. We ask that you consider a $10 donation, but if you can give more thats great, if $10 is too much for your budget we would be happy with whatever you can afford as a show of support.
1.3. Why Learn Another Programming Language?¶
Python is a great language for beginning programming for several reasons. First, the syntax is both sparse and clear. Second, the underlying model of how objects and variables work is very consistent. Third, you can write powerful and interesting programs without a lot of work. However, Python is representative of one kind of language, called a dynamic language. One might think of Python as being fairly informal. Other languages, like C, C++, and Java are more formal.
These other more formal languages have some advantages of their own.
First, is speed: For very large programs C and C++ are likely to give you the best
performance. Second, is their maintainability. Python
requires you to remember certain things. For example if you
t to reference a turtle, and forget later that
a turtle but try to invoke a string method on it, you will get an error.
C++ protects you from this kind of error by forcing you to be upfront and formal about
the type of object each variable is going to refer to.
In one sense Python is representative of a whole class of interpreted languages, sometimes referred to as “scripting languages.” Other scripting languages include Ruby and Perl. C++ is representative of what one might call industrial strength languages. Industrial strength languages are good for projects with several or many people working on the project where being formal and careful about what you do may impact lots of other people. Languages in this category include C, C#, C++, Ada, and Java.
The good news is that learning a second programming language is much easier than learning your first programming language because you will be able to draw upon your existing knowledge. Programming languages are likely to regularly change as time passes. As the field of computer science advances there are likely to be new programming languages that you will want or need to learn. There are certain features that most programming languages have in common such as variables, loops, conditionals, and functions. And there are other language features that are unique. If you know what is common in most languages, then in learning a new language, you need only to focus on what is different from the languages you already know.
C++ is an enormous language which is very powerful because it is a high-level language that offers low-level features, but one only needs to learn a small part of the language to write effective code.
C++ influenced many programming languages such as C#, Java, and other newer versions of C, so by learning C++, learning these other languages becomes much easier.
C++ is an industrial strength programming language and is very often used today for large systems by large groups of people.
C++ is particularly good at interacting directly with computer hardware, making execution very fast.
C++ was the first widely used object-oriented programming (OOP) language, supporting the four primary features of OOP: abstraction, inheritance, polymorphism, and encapsulation.
C++ allows the programmer to create and use a data type called a pointer explicitly, which can increase control over both memory and performance under certain circumstances.
Because C++ is fast, it is currently the language of choice for virtual reality.
Also, because C++ is fast, it is the language of choice of many 2D and 3D game engines.
For all of the above reasons, even though C++ is an older language, it is still one of the top listed in job advertisements.