harriyott.com

Code from 16 years ago

I've just located four floppy disks I used at sixth form college, which contain some code I wrote as part of my course. I'm about to look at it, and share my initial reactions. It's kind of the antithesis to Scott Hanselman's Weekly Source Code.

The one disk is labeled June 1992, so that would be at the end of my 2 year BTEC. Given that code I wrote last year is quite embarrassing, I'm expecting this to be truly awful. Still, it is also the culmination of three years of tertiary education (I did A-levels for a year before switching - I got an excellent mark for computer science, and rubbish marks for the others at the end of the first year, so I switched).

Firstly, floppy disks. I'm quite impressed that my (admittedly old) desktop PC has a floppy drive and the disks can be read at all. It's been a long time since I've inserted a floppy into drive A, and so it now feels a bit strange. Windows doesn't detect when the disks have changed, so although no longer a common problem, Explorer shows a list of files that are completely different to the ones on the current disk, until F5 refreshing. I only seem to refresh web pages these days.

Something else on floppy disks for you USB-happy kids. In the old days, some PCs (and I had one) didn't have hard drives, they had only floppy drives. Mine had two! I used to load the OS from drive A, and take the disk out. The whole OS would sit in RAM (I suppose), and any programs I wished to run I would load from another floppy disk. Any data would be saved to yet another floppy, which was why having two drives was super good; the data could be saved to a different floppy in the B drive.

Eventually, my Dad bought a 40Mb hard drive (which still isn't full) which became the C drive. I've kind of taken it for granted that the hard drive is the C drive, but that seems to be the standard now, and A: and B: are generally unused by floppy-less systems. So now children, that's why the C drive isn't the A drive.

OK, back to the code. I'm about to open the box...

The first file is from a Pascal program. I haven't written any Pascal since then, not even Delphi. The first glance shows me I used to be a bit funny about lining stuff up for no reason. The colons are all in a row, so that the data types are lined up too. Oh, and the same with my case statement. It's maybe more readable, but probably not worth doing.

Next up, there isn't a single comment in the 167-line file. Not even a file header. I can roughly work out what's going on though. Hang on, I've just seen one - it says "Get Valid Key" before the last line of the GetValidKey function. Well, that's something I've got better at.

Wait, what? That seems to be a nested function. Can you do that? The child function isn't actually called by anything, so I guess it must be run as part of the parent function in normal flow. Time to google...

Well blow me down. Ah, maybe it's because Pascal isn't object oriented, i.e. there are no classes, that this is possible. Wow. I've been OO for so long, this seems completely odd.

OK, what else? I've got some constants, but a lot of magic numbers, particularly for screen positioning. Screen positioning is interesting. As it's a console app, you can say gotoxy(35,1); and that will position the cursor on line 1, column 35, and then write to, or read from, the console.

My if..thens are all on one line, and I have no consistency for casing functions, parameters and variables. Still, they are generally named sensibly, so I could possibly argue that I was writing self-documenting code. Ahem.

That's probably enough for this file. Not as bad as I was fearing, but still pretty bad. What else is there? Golly, winfile.exe is there - that's File Manager, the predecessor to Windows Explorer (introduced in Windows 95). Blimey, and it still works.

Next source file is COBOL. There is one helpful thing that COBOL taught me, and that is how to spell environment. If you spelt that wrong declaring the environment division, then you'd have more errors than you knew what to do with. COBOL seems quite wordy: whereas now I'd do title.ToUpper() in C#, I did inspect title converting "mrsipofdr" to "MRSIPOFDR". (Dammit, I've put the R in twice).

This is an error prone way of doing case conversion; I've just spotted an entire alphabet version of the above, but I've mistyped the w as a q, which now appears twice. I wonder what would have happened to that.

Again, no comments. Well, I assume not. The whole thing appears almost as prose (e.g. label records are standard. and alternate key is surname-pd with duplicates.), so fewer seem to be needed.

Bored of COBOL now. Ah, here's some documentation for a Superbase (pre-cursor to MS Access) application. It's in Word 1.x, but it still opens. I guess the intended user is quite new to computers:

When the system is first loaded up you will be confronted by the Main Menu. This includes eight push buttons which can be activated by clicking on them using the left hand mouse button.


And I guess my technical authorage was as useful as my commenting:

If you want to add a students details then click on 'ADD A STUDENT'. The cursor will appear on the screen and you will be allowed to enter details. When you have finished you must click on the 'SAVE' button. If you wish to print all the students in the information systems file, simply click on the 'PRINT ALL' button.


There are some JSP diagrams in Excel files (which again, still open). The boxes were done by typing in a cell, and setting the border around the eight adjacent cells. Lines between boxes were created with top and left borders on the in-betweenies. Sounds horrendous, but back then I never needed to visit the visio-therapist. [My apologies]

There's a proposal from the Small Business Systems course module, which is quite dull, apart from the PC I speced specked specified:





Processor80386SX - running at 25Mhz
Hard Disk Drive42Mb
RAM2Mb, expandable to 16Mb. Compatible with LIM 4.0 EMS


This would have set you back £795, which sounds a lot, but was cheaper than the OKIlaser 800.

I've found another quote, from 23rd September, 1991, where a 43Mb hard drive cost £2099. Staggering. That's about one eighteenth of the size of a CDROM. Still, we didn't have digital cameras then.

Finally, here's a nice little office plan I designed myself. Note the disk box, which has its own special place on the desk. Bless.

Office layout

Well, I've enjoyed that little peek into my teenage coding years. A few memories have resurfaced, including a couple of people who I had completely forgotten about (hello Abdul!). In conclusion, I learnt some useful things there, and I'm now better than I was then (honest boss).

Right, now onto Facebook to hunt down my old classmates...
21 August 2008