C++ Metaprogramming

I got a new book today - C++ Template Metaprogramming: Concepts, Tools, and Techniques from Boost and Beyond.

It's an excellent book and is written by a couple of excellent programmers. I've used some of the ideas from metaprogramming in Sire (e.g. I use metaprogramming to perform dimensional analysis at compile time, or the "toString" function uses a little metaprogramming to work out how to turn an object into a string). However, my attempts are amateur compared to what is presented in this book. I can see that this may become recommended reading for other Sire programmers... :-)

Speaking of which, I think that I am reaching the point where perhaps I should start to let go a little, and begin to delegate some of the programming. Parts of the code are reaching the point where the APIs are becoming sufficiently stable that it should be possible for other people to write code against them without the threat of me completely rewriting the code again! Public program interfaces are like most other things - they have three states; gas, when they are just hot air, liquid, when they are visible, but flow and change and will wash the unwary programmer away, and solid, when they are then sufficiently strong to support upward construction. There are parts of Sire that, while not fully solid, have at least become very viscous, and have formed a crust, e.g. the molecule interfaces and the forcefield interfaces. It should be possible now for other programmers to begin to write some forcefields...

Today I rewrote the replica exchange code that I have been writing for the last week. This is the third rewrite of this code, which is about par for the course. However, all three rewrites have taken a week (as opposed to three rewrites taking months or years). I think that it is because I have now accepted that I will write a piece of code about three times, so am much happier to rush the first couple of iterations knowing that they will definitely be rewritten. This contrasts to my original programming style that demanded perfection all of the time, due to the fear that prototype or rough code always ends up become permanent (how many temporary solutions have stayed temporary forever!).