Moving from Python to C++
Writing better object-oriented programs.
James W. Cooper
If you know Python, you’ll learn C++ very quickly from this book!
C++ programming
Syntax, input, output, formatting
loops, arrays and strings
making decisions
functions, pointers
sets, tuples and maps
classes, OOP and inheritance
templates
user interfaces using wxWidgets
Application Programming
Armadillo math library
Plotting in C++: SciPlot, ROOT
Database programming:
SQLite, MySQL
Facade pattern
Advanced Programming: Design Patterns
Factory patterns:
Simple,
Factory Method,
Abstract
Adapter patterns
Bridge pattern
Learn C++ and create GUIs
After covering C++ fundamentals we show you how wxWidgets can be used in place of Python’s tkinter.
The Armadillo math library
We show how the Armadillo math library can be easily be used in place of Python’s numpy. We also cover SciPlot for plotting numerical data like MatPlotLib does.
Databases in C++
We show how to connect to SQLite and MySQL, using a Facade pattern.
People who have been programming in Python eventually run up against its limits. While the language design is appealing to new programmers, they eventually find that they need a more professional language and naturally turn to C++, which is similar enough that the learning curve is relatively small.
This book uses examples that look enough like Python, that readers will easily begin to make the transition to C++. It repeatedly refers to Python in explaining analogous C++ features.
And what do they gain from this transition?
- C++ is a compiled language that runs substantially faster than Python can.
- C++ eliminates the dreaded Python “indentation error” messages that can slow down and baffle Python programmers, because C++ groups code using braces instead of just indentation.
- C++ requires that you declare all variables in advance and specify their type. Python does not have this requirement and can lead to your reusing a variable and changing its type in the process and causing great programmer confusion.
- C++ is a true polymorphic language. You can have functions or class methods with the same name and different argument types, which is not possible in Python.
- C++ eliminates the clumsy creation of variables inside a class using the self pointer to that class instance. Instead, you declare to variables at the top of the class by name and type. This is much less error prone.
James W Cooper is the author of 21 previous books.