In this post I want to sum up things and facts that I think are important learning C++. I want to remember them quickly instead of digging through 1000 pages just to find a sentence. Be prepared for a lot of details, because details are the things I tend to forget most.
I use Programming: Principles and Practice as my main source of study, and therefore I am going to write them in order similar to the order they appear in book.
The most important advice is: Think about invariants and test, test, test!!!
I can not stress the importance of testing. Test as you write. Test even the smallest functions and classes. When designing functions and classes think about invariants and corner cases. These will help you catch more errors early and save yourself from a lot of frustrations later.
To learn to program – program. A lot.
I mean it. If you encounter a problem that can be solved by computer program – try to write a program to solve it. First of all, it is great fun and leaves you with a feel of accomplishment and increases your confidence. Second – do not wait to “know enough language” to begin solving practical problems.While C++ is complex language, a small subset is enough to tackle non-trivial problems. And you can always google, if you do not know how to do solve a particular problem. By doing these you better understand both the language and problems you are trying to solve. By the way, there are more practical problems than you think. If you are in university, try to write a matrix calculator or derivative calculator to
do check your homework. If you need something calculated often enough – write a program to do that for you.