Some people speak English, French, German, Spanish, Russian and Swedish. I speak BASIC, 68000, C, Tcl, awk, PHP…
Every coder has their favourite, but I’ve yet to meet the perfect programming language. That fine balance of terseness, expressiveness, logic and power that makes me smile inwardly at its sheer elegance to do… stuff.
That’s partly why I believe in the best tool for the job at hand and why — through my many ventures into different systems over the years — I always come back to scripting languages instead of big boy programming languages. They’re like glue that can bind together disparate systems with ease. Yes, they’re dirty, but they get the job done rapidly.
My current main squeeze is the slightly backwards and mis-shapen, but hugely prevalent PHP. There are better languages out there, so how did I come to rest here? Glad you asked…
Language through the ages
I’ve hardly been formally taught any language. If I try one and it gels, I’ll pick it up. They’re all pretty much the same anyway. For the vaguely interested / nostalgic, here’s my programming history and my take on each, which you may find amusing:
- BASIC. Fond memories of tapping away on the family Vic20 (the forerunner to the Commodore 64) with 5KB of RAM and a 16KB RAM pack. I could
10 PRINT "Stef" 20 GOTO 10all day with this sucker. And when the Sinclair Spectrum arrived, my skills were instantly transferable, yay!
- Hex codes. Lovingly typed byte by byte over months from listings printed in the back of Speccy mags, there was always that air of trepidation, waiting with partially bated breath, finger hovering over the Enter key, launching the final program… and watching the computer crash amid a dazzling array of multi-colour, blinking 8×8 squares. The magazine would print the errata the month after, by which time I’d have invariably destroyed the tape with the code on it.
- Z80 machine language. If you want to feel like a real programmer, machine code is where it’s at. After a week of getting sod-all done you feel like you’ve been dating a sumo wrestler named Greg in a one-sided relationship based purely on sado-masochism. But it teaches you discipline.
- Pokes. I had a little black book chock full of pokes for Spectrum games. With the trusty Multiface 128 plugged into the expansion port I could press the red button, freeze the game and POKE. Tearing code apart was way more fun than coding.
- 68000 Assembler. Breaking out the 16-bit big guns and being wowed by demos on floppies ordered from hackers on bulletin boards I got heavily into Amiga Machine Language. Horizontal refresh rates, Copper, Blitter and HAM bitplane manipulation were my currency, with a healthy dose of Multitrackers thrown in for the accompanying audio. And it was all good.
- ARexx. A handy glue language to squirt stuff between Amiga apps. Never fully gave it the time it deserved, but it was pretty neat to get me out of a tight spot once or twice.
- Pascal. Formally taught at school, I was told this “jump off” language (as my computer science teacher called it) would lead to better things. And it did: it led me to a fierce hatred of strongly-typed languages.
- Logistics. My A-level computer project was written entirely in this spreadsheet package on an RM Nimbus. For the life of me I can’t remember what I made it do. Probably Global Thermonuclear War. Oh, no, that was Joshua.
- HTML. Writing my University home page on JANET allowed my friends to see my handiwork in their campus rooms using Netscape Navigator 1.0. Wooo! A year later they could view it over this newfangled Internet thingy. Ha! It’ll never take off.
- Shell scripting. When HTML wasn’t enough I switched to cgi-bin to do more. Pretty cool what you can accomplish with a few GET parameters.
- C. Formally taught at University, this sucker was a step up from Pascal and bridged the gap between what I knew the underlying instruction set was doing and the easier syntax of a high level language. Allowed me to get a 1st for my Final Year Project so it can’t have been all bad.
- Excel macros. Wrote a series of 1000+ line macros and front-end data input screens to control, manipulate and graph factory quality data.
- MS-DOS. Tried my hand at batch scripts for doing things. Hated it. Too much Goto.
- awk. Migrating from csh to the more powerful ksh and eventually to bash I stumbled upon awk: a wonderful scripting language for doing line-based input processing very efficiently. The familiar control structures of C without the need to initialise variables. Bliss. Still use it to this day, on and off.
- C++. wtf? I can overload the
++operator to mean subtract? Who invented this shit? Bye!
- Java. Ahhaaaa. Objects and inheritence done right. A fabulous language marred by the fact it’s ridiculously slow and the API changes every week, so 530 lines of code I wrote the month before could now be done in one line. If only I could com.find.the.right.package.method. When Swing came out and it required a 150MB download I ditched the language. In good time it seems, now Oracle have their mitts on it.
- Tcl/Tk. Another scripting language which is superb fun. Used it to write a web templating system — a kind of forerunner to a CMS (without the database) — where I could generate web pages with dynamic content. Tk was the graphical component used to capture the input and throw it to the Tcl scripts to generate the content.
- Expect. An extension to Tcl. Phenomenally powerful at interfacing with other programs like FTP for automating batch jobs. Or with telnet for hacking :-)
- CSS. Separating data from display? No more 1-pixel gif tricks in my web pages? Ah the passing of an era and the dawn of a bright new one. If only the browsers would agree on how to render the results.
- PHP. I’d never written a line of PHP before I found it — almost by accident — when I discovered the awesome little Textpattern CMS. It was only through my desire to work with Txp that I got into PHP and now kind of half like it. Its parameter inconsistencies annoy the legs off me, but as long as I have php.net at hand I can cope.
- YAML. A brief skirmish with this one left me impressed but equally aloof. Incredibly handy in the right situations, I may well be popping back to the *ML door at some point.
- Python / Perl / Ruby. These are all languages I should have learnt, but just never clicked so I didn’t put the effort in. All fabulous in their own right, I’ve heard. Well, apart from Perl which is only good if you’re a complete nerd and enjoy demonstrating your considerable superiority over others.
If you can still read this text through your glassy eyes of nostalgia, that about sums it up. As you can probably tell — aside from things like Fortran, Cobol, Prolog and Lisp — I’ve tried most flavours of language. But the scripting ones are the ones that make me feel more free; more like I can accomplish stuff quickly and easily so they are the ones I keep coming back to time and again.
Languages like awk are just fabulous for knocking up quick and dirty code. Someone once asked me to look over the statistical model for game show probabilities to prove the calculations were correct: there was a lot of prize money at stake!
Instead of trawling through 20 spreadsheets of numbers and cells referencing cells referencing other cells, I threw together a 100-line awk script in an afternoon to simulate ten thousand or so actual episodes of the game show. It tracked and logged the result of each game, then collated all the info and squirted out the mean probabilities at the end of its few-minute run cycle. Give or take the odd quarter percent statistical variance, the actual values obtained from the script matched the theoretical values so I wrote and told the guy his spreadsheet was correct :-)
I guess some people like the structure and comfort of a strongly-typed language. I prefer to hack and hope, which is perhaps a testament to my largely self-taught programming roots. Either way, with the arsenal of languages I’ve tried and all the ones out there yet to be invented I’m confident that any software task can be solved by using the right tool for the job.
And if it requires a script, I’m your man.