Code

Computer programs are useful for the automation they allow, whether it is of numerical calculations or higher level operations. In the course of my research I used a variety of programming languages for a number of tasks related to either control of the experiment, data analysis or simulation of the physics of a system. I also like programming as a hobby, so there are a few programs here that are not directly related to my research (except in the sense of developing useful computer skills).

(Now it is 2014 and 10 years on from when I wrote the above. Still programming as a hobby but have also been doing it as a career).

Current projects

Most of my current non-work related projects (as of 2014) can be found on mattmcd GitHub. I've recently been playing around with Google Native Client (NaCl) and have a demo that uses the OpenCV image processing library within the Chrome browser.

Types of programming laguages

The main types of programming languages are imperative languages and functional languages.

Imperative programming

Imperative languages are those that most people are familiar with such as Pascal, C, Matlab, FORTRAN, assembler etc. These languages make a distinction between data and functions acting on the data. Program execution then consists of performing the set of instructions one after each other to produce changes in the data. This style of programming is very close to what actually occurs at the hardware level in a normal computer, where memory and execution locations are separated physically between the RAM and the CPU's Arithmetic Logic Unit. The advantage of this style of programming is this closeness to the "bare metal" of the machine, i.e. it is possible to use the full power of the computer at its lowest level. The disadvantage of this style of programming is that side effects of functions on the variables mean that the same function acting on the same arguments at two different times may give two different results. This can lead to hard to diagnose bugs in the program (and is why using global variables is considered harmful).

Functional programming

Functional programs treat data and functions as being the same, i.e. functions can take other functions as arguments and return them as results.
Computation then consists of composition of functions one after the other until a final function is returned as the result (in practice a number of languages, such as Ocaml, allow some imperative operations such as file IO for returning results).

The functional programming approach allows a greater degree of modularisation than is possible with imperative programs, and avoids the problem of side effects. The ability to use higher level constructs also means that the actual program code tends to be shorter than for imperative programs. The disadvantage of the functional languages has traditionally been their comparatively slow speed, however there are now a number of compilers that allow speeds approaching that of C (compiled Ocaml code can be faster than compiled C++ code).