Ugh. Memes. How I Got Started In Software Development.

Thanks to Colin (Stuff that’s in my head) and Barry ( for tagging me in this meme.  I’m only promoting it because it gives me a chance to document a little bit of my past…

How old were you when you started programming?
I suppose I was about 12, probably tinkering with a TRS-80 (in Tandy/RadioShack), an Acorn Electron, a ZX-81 and an Oric 1.

However it wasn’t until I was 14 when a BBC Micro (Model B) arrived complete with it’s User Guide.  Those where the days when user guides were real user guides and …  The User Guide itself was over an inch thick and was ring bound.  The ring binding was perfect, you could lay it flat on a table and it would stay open, great for typing whilst reading.  This is in complete contrast to the RISC OS 3 Programmer’s Reference Manuals that accompanied the Acorn Archimedes (more about this shortly).  I learned everything there was to learn about the BBC, in some cases this meant getting very intimate with SHIELA, JIM and FRED – sometimes all at the same time (user guide page 421)!

Those were also the days of cassette-based storage.  How slow were they?  Very slow.  Indeed, when I finally got a 5.25” disk drive, I spent a lot of time moving tape-based programs on to disk.  Of course, some tape-based programs where fussy and insisted that they load and run from “PAGE &0E00”, whereas the disk control moved the base page to &1900.  So I spent more time working out how to load programs into a different PAGE then magically move it to where it expected to be where it could then be executed from.  The process of moving tape-based programs onto disk was something I became pretty good at.

How did you get started in programming?
I guess that I have my father to thank for this!  When we were in Libya, he brought home fan-fold listing paper for me to use as scrap paper.  Whilst a lot of it was ‘address listings’ and other such program output, some of it contained COBOL listings. 

What was your first language?
That would be BBC Basic.  I can’t remember how long it took me to master it.  BBC Basic had the advantage of a built in assembler – anything that was a little bit slow in interpreted Basic could be hand-cranked using 6502 Assembler.  They were the days – it was possible to learn how to understand the entire computer: it’s architecture, it’s hardware, it’s interfaces, you name it.

What was the first real program that you wrote?
I don’t know if I can remember the very first program that I wrote.  I can remember writing a number of programs whilst at school.  There was a network broadcast program that I called Channel 5 – obviously long before the TV station came along.  Then there was my A-Level project, a program that created graphs – it had to manage data, graph plotting and printing: a tall order in those days.

Part of the graphing program involved sorting data.  After the graph data had been loaded from file, I was using arrays to hold the data in memory.  My sort routine involved looking at the first element of the array, then comparing its value with the second element – if the first was less than the second, I’d use a temporary variable to allow me to swap the array elements.  I was, as you might imagine, very pleased with myself – this was a really cool sorting method!   Of course, like many/all first-time programmers, I believed that I was the first person to “invent” this sorting technique.  Oh how much I had to learn – it didn’t take long for the bubble [sic] to burst!

What languages have you used since you started programming?
ARM Assembly Language, Turbo C, Turbo C++, Turbo Pascal, ML, Perl, COBOL, Borland Pascal, Delphi, Visual Basic 6, Classic ASP (VB), PHP, Visual Basic (.net), C#.

What Was Your First Programming Gig?
Gig? I suppose by this it means where I was actually paid to write code.  That would have been in 1990 when I spent a year working for IBM in Hursley, near Winchester.  At the time I was an avid Turbo Pascal fan – my first boss was a Modula-2 dev-head, he loved it.  I inherited a C language parser written in Modula-2.  It was fun working on the parser…until I discovered that the recursive nature of the parsing process wasn’t controlled using local variables as it should be, but was controlled using global variables.  I think this was close to my first “OMG, I don’t believe it” moments (I’ve had plenty more of those since then!)

If you knew then what you know now would you have started programming?
I think the short answer to this question would be yes, yes I would have started programming.  However would I have chosen to learn assembler language?  In today’s abstract world, with class libraries getting evermore feature rich, it seems that fewer folks truly understand today’s processors at an instruction set level.  I wonder if there will be a shortage of assembly language developers in years to come? 

If there is one thing you learned along the way that you would tell new developers what would that be?
Keep it clean, keep your code clean.  It’s difficult to teach “feeling” – when I’m writing code I often know very early on that I’m probably writing code that will be difficult to maintain – it’s at that point I stop and think about better (read: simpler) ways of achieving the same thing.  In the same thought, I’d also recommend that you shouldn’t try and write perfect code the first time.  Don’t be afraid to write code with refactoring in mind – there are plenty of good tools that will help get there!

What’s the most fun you’ve ever had … programming?
You might think I’m weird (or may be wired) however this is an honest answer!  Back in about 1994 I was working in Newcastle as part of an Acorn Archimedes library development team.  One of the application developers was about to go on holiday, he had been frantically getting his CD-ROM based application ready for production.  Disaster struck, somehow he managed to delete his source directory (yes, backups, yada yada, I know…)  Rather than let him cancel his holiday, I hauled his Acorn A5000 into my office space (thus I had two A5000s) and proceeded to recover as much of the source code as I could.  I couldn’t get it all back, so in the two weeks that he was away, I filled in the blanks.


Tag, you’re next: Richard Peat, David Christiansen, Ian Smith, Scott Lovegrove, Danny Thorpe

Implementing Excel’s STDDEVP in C#

I have been adding functionality to one of my applications. Without going into huge amounts of detail, it’s a C# application that pushes data out to Microsoft Excel – end users like Excel! The functionality that I’m adding was prototyped inside Microsoft Excel using simulated data and…the Excel Analysis Toolpak. To cut a long story short, I really wanted to remove the reliance on the Toolpak. In fact, I really wanted as much of the control element pulled back into the C# application, i.e. I wanted Excel doing more presentation of data and less scripting.

Part of that functionality involved replicating a few of Excel’s statistical functions, most notably STDDEVP (more details here)

Of course, it’s very likely that there’s a .NET implementation available in the .NET Framework…however my brief search was inconclusive, so I set about writing my own. The code you see below will compile and run using Visual Studio 2005. If you are using Visual Studio 2008 you can take advantage of the built in Sum, Average and Count methods (e.g. total = n.Sum(); instead of the foreach…total+=num loop)

[C#, compiled and tested using Visual Studio 2005]

class Program
    static public double STDDEVP(params double[] n)
        double total = 0, average = 0;

        foreach (double num in n)
            total += num;     
        average = total / n.Length;
        double runningTotal = 0;

        foreach (double num in n)
            runningTotal += ((num - average) * (num - average));

        double calc = runningTotal / n.Length;
        double standardDeviationP = Math.Sqrt(calc);

        return standardDeviationP;

    static void Main(string[] args)
        double s = STDDEVP(1, 2, 3, 4, 5, 6, 7);

This worked for me – your mileage may vary.

Technorati Tags: , , ,

[geek thing] It’s a long way to Aberdeen from Dunfermline…longer now

Yes, I realise that what I am about to write here is perhaps taking my status as a geek too far….

Within the last 10-12 months, I noticed a handful of road engineers physically removing a motorway distance to destination sign. It was on the northbound M90 just after the Admiralty “Sky TV” junction. At that time, Aberdeen was 112 miles away.

I was a little surprised to see the replacement sign being installed about 5 feet in front of the existing 112 miles sign. I was surprised for two reasons. Firstly, there was nothing wrong with the existing sign – it was in perfect condition as far as I could tell. Secondly, the replacement sign had Aberdeen marked as being 115 miles away. I can’t imagine that Aberdeen (or Fife for that matter) had moved 3 miles further apart.

However, after the works had been completed I noticed that the sign didn’t read Aberdeen 115 as I expected it to – it read Aberdeen 117. So Aberdeen and Dunfermline were now magically 5 miles further apart. I’m sure this fact pleases some people, however I was more intrigued at how such a mistake can be made…either the original 112 was incorrect or the new 117 is…or both as the image below might confirm.

In reality, the Aberdeen 115 sign was located less than a half mile further south (back “down” towards Admiralty). Thus the first sign we see is Aberdeen 115, then a few seconds later, we see Aberdeen 117…even though we have driven “up” the motorway in a northerly direction.

Who does one report such “issues” to? I’m going to contact Transport Scotland to find out!

Technorati Tags: , , , ,