Archive for the ‘Craft of coding’ Category

The joys of Literate Programming

Monday, January 26th, 2009

[caption id="" align="alignleft" width="300" caption="Photo by timbomb"][/caption] Software code is machine-readable.  But sometimes it's not very human-readable. for i=1:n d = function1(i) f = function2(i) a = function3(d) aa = function4(d) aaa = aa^2 for j=1:nn d(j) -= a d(j) /= aa if aaa > vt, f(j) = TRUE, end end function5(d, i) function6(f, i) end (we've actually seen real code where the author used variable ...

Links to some great articles on programming

Monday, January 19th, 2009

[caption id="attachment_410" align="alignleft" width="300" caption="Photo by Manel"][/caption] The internet is full of smart people writing intelligently on how to write good software. Very few of these articles are from the perspective of a scientist (hence this blog!) but a lot of what they write is useful, interesting and, occasionally, entertaining. This ...

Do I need to write software?

Monday, January 12th, 2009

[caption id="" align="alignleft" width="240" caption="Photo by Jan Tik"][/caption] In a previous post, we discussed what our project objectives were and how collect them.  We've also considered how to choose a programming language , as well as how to write pseudocode and build a prototype.  But we've missed something.  We've made an implicit assumption ...

“Almost the square root of 2″ – rounding errors in computer code

Monday, November 24th, 2008

[caption id="" align="alignleft" width="300" caption="Photo by Waka Jawaka"][/caption] Computers are great for handling numbers and doing large amounts of operations on them.  They can repeat the same operation over and over again and they will do the same thing every time (unlike a human, who will sometimes do the wrong thing ...

Surviving legacy code

Monday, November 10th, 2008

[caption id="attachment_337" align="alignleft" width="300" caption="Photo by hryckowian"][/caption] During Rich's PhD, he was presented with some code and told to use it as the basis for a project he was working on.  This generosity turned into a major headache for a number of reasons, not least because the (somewhat sparse) comments were ...