Writing Scientific Software - A Guide to Good Style (Suely Oliveira and David Stewart; Cambridge University Press, 2006)

Write good software

Implementations of mathematical algorithms surround us. Mobile phones, iPods, cars, Google search engine, washing machines, digital cameras, to name but a few examples. Many (if not most) algorithms used in such devices and software are based on numerical computation.

There are many excellent textbooks on numerical analysis and scientific computing, but only a couple trying to teach how to implement these algorithms using a good programming style. Oliveira and Stewart have written an excellent book, which suits both the novice and the experienced programmer.

When writing scientific software, you should prioritize robustness first, flexibility second, and efficiency third. Robustness requires correctness, numerical stability, and accurate discretization. These are not easy targets to meet. There are cases where badly behaving software has caused huge economic losses and even loss of life. Chapter 4 of the book provides some illustrative examples of this.

Having written books (in Finnish) on numerical methods, scientific software, and programming in Fortran 90/95, I must say that Oliveira and Stewart have written a book which I wish having written. They have done such a good job that there is not much to improve. Of course, each reader has their own areas of interest, and the examples given in the book cover only a small corner of the applications of numerical algorithms.

The book contains code examples in C, C++, and Fortran 90, which is the optimal content for a book on programming for the researchers who need to write software. There are also insightful comments about programming with interpretive languages like Java or Matlab. The authors clearly know what they are writing about.

The book provides a concise review of the basics of numerical analysis, architecture of computers, software design, testing, efficiency, and programming tools. Perhaps a few more involved design examples could be added, but on the other hand the book contains 300 pages already.

A key question concerning a book on numerical algorithms is the selection of code examples to be included. Some books (such as the "Numerical Recipes" series) have emphasized simple and short codes. However, real-life algorithms are hardly ever simple and short. Instead, you need lots of code to avoid errors, to check initial data, and to recover from failures.

Usually the short and simple codes are not those to be recommend in practice. Unfortunately the most robust and fastest codes are the most complicated to implement.

I recommend the book to computer scientists, engineers and researchers who need to work with novel numerical algorithms and implement them in software. The book contains an index and exercises, which provide additional value as a reference and for the classroom.