About the Book
There are certain programming habits that tend to produce unreadable and low-performance code. These habits are inherited from dated code, or passed on from trainer to trainee.
Readability should be the prime aspect of your code, because it has the highest return on effort, compared to other techniques which aim to improve your product's quality.
- Quality: Bugs are found mostly by reviewing other people's code. You can't review somebody else's code if you cannot read it. Bugs are not found by unit-tests, because unit-tests are created to capture errors that we know they exist in the code. Unit-tests only catch bugs that have been re-introduced.
- Efficiency: Maintenance takes about 80% of developers' time. Therefore, spending some time for writing better code will save you up a lot of time when you have to maintain it.
- Performance: Unreadable code is difficult to reason about. Therefore any opportunities for optimisation that may exist are often impossible to notice and fix.
I describe six basic techniques that you can follow in order to eliminate these habits. These techniques can be learned one at a time, improving your coding level progressively. At the end, you will have developed a programming style that
- is more readable,
- leads to more maintainable code,
- promotes reusability, and
- often leads to faster code.
All these qualities are not mutually exclusive, you will often achieve all of them at the same time.
The techniques are easy and therefore
- students can apply them
- it helps smooth transition from C to C++, without having to change programming paradigm
- it allows C++ programmers to write using native idioms, instead of writing like C, Java, or Fortran.
C++ for dinosaurs is also available as a printed book at lulu.com.
About the Author
Nick Economidis has worked in the interactive-graphics, CAD and CAE business with C and C++ for more than twelve years. He has applied for patents on interactive graphics and video subtitle compression, while working at Philips Research. Nick currently works at BETA CAE Systems. He is a contributor to the development of the xMCF format, a joint effort of German automotive industries, lead by VDA, to standardise an interchange file-format for assembly description across CAD, CAE and manufacturing. He holds an MEng in Electrical and Electronic Engineering from Imperial College London. Nick maintains a blog on C++.