Arbitrary Version Numbering

So with all software, no matter how small, it seems like it’s a good idea to have version numbers. Mine are pretty arbitrary. I try and keep whole numbers as milestones. Like when the code is running in a more or less feature complete form, it’ll be a 1.0. There’s a lot of 1.0s running around.

The primary benefit of this is that, when you look back at your working directory, you’ll be able to have some semblance of the MESS of files that are lying around, all with the same names from copying and modifying files.

Another useful tip is revision numbers in the beginning comments. I can’t understate the importance of this! Otherwise you’ll go nuts later. A simple header like the following is so useful:

function fData = frequency(input1,input2)

% FDATA = FREQUENCY(INPUT1,INPUT2)

% will return the frequency of firing for

% a given input1 and input2 blah blah, etc.

%

% Version 0.9

% Rev. 2007-08-25

Simple and you’ll thank yourself in 6 months when you’re writing your paper and revisiting your code, trying to figure out what on earth you had done!

Another useful tool in determining file differences (UNIX/Linux/Mac folks) is diff. If you have two files for comparison that are the same name (!), then you can use diff to figure out line by line differences. The program is pretty smart and quite simple to use:

diff ~/origdir/frequency.m ~/someotherdir/frequency.m

will give a simple output to the screen with < and > lines marked to note file differences. < means that the line was included in the left file (in origdir) and missing in the right file, and vice versa with >.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s