The basics of…Matlab

November 17, 2008 – 9:58 pm
Photo by kennymatic

Photo by kennymatic

It’s important to know the basic features of any language you’re programming in.  We don’t just mean the syntax or whether the language is dynamically or statically typed (although these are very important); you also need to know what the language is good for, what it’s not so good for (and why), and any particular quirks it has that might otherwise catch you out.  To this end, we present the “Basics of…” series of posts about different programming languages.  We’ll assume that you know the basic syntax of the language in question (there are almost always lots of good ways to learn this) and try to present the things you’ll need to know right after that.  We’ll start with Matlab. Read the rest of this entry »

Surviving legacy code

November 10, 2008 – 4:38 pm
I will survive!

Photo by hryckowian

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 written partly in English and partly in Portuguese (!).  Many people encounter legacy code during their programming career and the scientist-programmer is particularly vulnerable because of all the “challenging” code that exists in science. 

Read the rest of this entry »

Book review of … The Pragmatic Programmer

November 3, 2008 – 4:23 pm
The Pragmatic Programmer by Andy Hunt and Dave Thomas

The Pragmatic Programmer by Andy Hunt and Dave Thomas

The Pragmatic Programmer: From Journeyman to Master‘, by Andy Hunt and Dave Thomas.

An essential part of the education of any scientist-programmer (indeed, any programmer full stop) is reading good books on the subject. So we’re going to review some of the books we think are both super-useful and also accessible/easy to read. We’ll start with ‘The Pragmatic Programmer’.

Read the rest of this entry »

Code that’s good enough…

October 28, 2008 – 9:58 am
Photo by The Wandering Angel

Photo by The Wandering Angel

Let’s face it, there can be a huge temptation to keep polishing and honing your code almost indefinitely, to get it “Just Right”.  This is good because it shows you care about making your code work really well; caring and taking pride in one’s work leads to producing really great code.  However, there is such a thing as to much of a good thing.  To strike a balance and to make sure that you don’t just go on tinkering for ever, it’s important to have some understanding of when your code is “good enough”.  This can mean a number of different things, depending on the context, and all of them are important to at least some degree. Read the rest of this entry »

The basics of…pseudocode

October 20, 2008 – 11:09 am
photo by WorldIslandInfo.com

photo by WorldIslandInfo.com

Pseudocode is the code you would write if a computer was as smart as a person. It is a way to capture the logical rigour of programming language, without the messy syntax, but maintaining the flexibility of human language. Pseudocode is therefore a cross between full blown code and a purely human-focussed description of what the code will do. It is a way of laying out the structure of your program, algorithm or any other complex piece of code so that you can check your logic is clear before investing a lot of time writing the code. Read the rest of this entry »