cjwatson: (Default)
Col ([personal profile] cjwatson) wrote2014-12-13 03:04 pm

December days: Programming languages

[livejournal.com profile] ewx prompted me to write about programming languages, and said "be as specific or general as feels appropriate".

Answering prompts with a personal-history kind of framing seems to be working quite well this month, so I'll stick with that for this one. I started programming when I was seven; that was on a ZX Spectrum+ which was a lovely piece of hardware for the time, so the language available was Sinclair BASIC. This wasn't a bad BASIC dialect, and I remember its PRINT command having some useful gadgets. The limited memory and the very odd encoding (numbers were always five bytes; reserved tokens were always one byte) meant that it was sometimes worthwhile to go through some ridiculous circumlocutions which have stuck in my head: INT PI was two bytes in memory against five bytes for 3 (ditto SGN PI for 1 and NOT PI for 0). At any rate this kept me going until I was 11, at which point we got an 8086-based PC.

There was a dark stage for about a year here where I didn't have any programming language worth mentioning, because MS-DOS 3.3 (I think it was) didn't ship with one. Batch files were sort of barely functional for a few things, and if you were really determined it was possible to do things like write a minimal calculator in them, but it wasn't exactly pleasant. Out of a mix of desperation and curiosity I resorted to teaching myself assembly language via DEBUG.COM; I haven't used that experience much since, but it was probably worth having done at least for a while.

When I was about 12 we upgraded to MS-DOS 5.0, which shipped with QBasic, so I had a more or less familiar language available again with slightly different quirks. Not having to number lines manually was a bit of a revelation, and I seem to remember subroutines being noticeably better. Some things were more annoying, and I seem to remember putting in some effort to add some of the facilities that the Spectrum's PRINT command had. I stuck with this until I was about 16 or so, including going to the All-Ireland Schools' Programming Competition (which I think is now the All-Ireland Programming Olympiad); I placed respectably enough but not particularly close to the medals, and reckoned that some of that was due to trying to use BASIC, which was just a bit too clunky for the job.

That summer I went on a residential course in Dublin where I learned Pascal, and that made a big difference, though part of that was probably just due to the mental flexibility involved in having learned a second language. The next year I went back to the same competition and felt I'd done much better. I sat through the awards ceremony, of course presented in reverse order, figured I'd just missed out on the medals and might try again next year, and almost fell over when they announced I'd come first. This of course did a lot for my confidence and meant I got to go to the international competition, which was mainly useful in that it was the first time I'd really hung out with other serious programmers.

I learned C at some point before going to university. If memory serves it was initially a dialect called Pacific C, although I haven't retained any of its idiosyncrasies. I think I then used Visual C++ for a bit, until I switched to Linux-based systems in 1998ish and taught myself GNU C, which even at the time was much closer to the standard. (It wasn't until a year or two later that I got hold of a copy of K&R II, at which point things started making a lot more sense than whatever I'd picked up through osmosis.)

At university they taught us ML (on the reasonable basis that virtually nobody knew it already so it levelled the playing field) and Java. ML was excellent at broadening the mind but I never kept it up. I used Java for a while, but eventually I decided that it just felt too clunky for me and I was running into its limits a lot in terms of what systems programming was reasonable at the time, and I've avoided it since.

Once I was using Linux, the scripting facilities were a lot more powerful and it often made sense to use them for things where I'd previously have used full-fledged programming languages. I used a lot of bash, sed, awk, and such around this point. In 1999 or so I taught myself Perl, and that was another big step up in terms of how quickly I could get things done. Perl is often criticised for being a write-only language, and I admit that I've occasionally contributed to this, but I think my normal style is rather more readable and it's mostly fine if you refrain from playing silly buggers too much. It remained my language of choice for some years, including lots of work on the Debian bug tracking system which is written in Perl.

When I started working for Canonical, Python was the preferred language there, so I taught myself that. That was just as well since I soon found myself being handed stuff like Germinate to maintain (nowadays it looks more like this, which is a bit more tractable). Nowadays I'm very comfortable in Python, either 2.x or 3.x, and my new job will involve even more of it. It's a reasonably nice general-purpose language with generally excellent library facilities; it's maybe not the fastest thing in the world with the standard implementation but it's not terrible, and I feel pretty comfortable with its quirks.

Apart from the time spent learning ML at university, all of these fall into the general category of procedural/imperative languages, and I have to admit I really haven't done much outside that sphere. A number of people I respect are big fans of functional languages, and I suspect that at some point I will end up teaching myself Haskell. I've done some work related to that before in a rather strange way, but I never really taught myself more than a minimal amount of the language as a result. (On the other hand, it did cause some local Haskell developers to buy me drinks, so that was a win.) Once I have more energy for free-time experimentation again then this might be reasonably high up my list.

Virtually all of this has been self-taught. I did have some formal programming education (A-level computing, which in this area at least mostly covered ground I already knew, and university), but it's mostly been driven by what I needed at any given point rather than learning new languages for the sake of it. That said, if you're learning to program I strongly recommend learning more than one language once you're over the initial hump, just so that you have a better idea of what's intrinsic to the field in general and what's just a quirk of the language you learned first.

This post is part of my December days series. Please prompt me!
liv: alternating calligraphed and modern letters (letters)

[personal profile] liv 2014-12-14 07:06 pm (UTC)(link)
I found this really interesting, thank you for talking about it! I think part of my response is that the beginning of the story is very similar to my experience of programming in the 80s. We were a BBC Micro family, so I learned BASIC on that, and it was something I found incredibly satisfying, being able to type words and make the computer do what I wanted. A lot of script kiddie stuff where I figured out which bits of code I could alter to personalize programs while keeping the underlying functionality the same, but then I was a literal kid, most of this happened when I was under 10. And I do remember some bits of finding ways to work round the limitations of the language and the hardware. A friend of my dad's helped me to write something to expand the range of colours available beyond the seven in Mode 2 and only four possible in modes where you had any sort of access to reasonable graphics; discovering how to make things orange by combining red with yellow is one of my favourite memories of that stage in my life.

Then we ended up with early Apple Macs (cast offs from Dad's work), which were all GUI and didn't have an obvious way to get into programming, and I was out of the habit by the time I encountered early PCs. By the time I was 12 I was attending a stupid school where we were strongly discouraged from building up skills with computers, because nobody understood the difference between programming and IT, and even worse thought that having IT skills was a bad idea because it would mean people would assume we were only good enough for low level admin jobs. So I never got to the point of building on those early skills of digging around in BBC BASIC, and I really very much regret that. Though [personal profile] hmw26 came through the same school system with me and she's ended up quite a big name in both Open Source and commercial and academic computer science, so I can't completely blame my school.

So anyway, if you're still looking for prompts, can you talk about whether you're planning to teach your children programming, and if so how? I mean, I guess if the answer is no that might not be a very interesting post, but I would still be interested in why not!
liv: cartoon of me with long plait, teapot and purple outfit (mini-me)

[personal profile] liv 2014-12-15 10:20 pm (UTC)(link)
Huh, I didn't realize computer teaching was still so completely awful, I had assumed that the whole thing of needing to self-teach was just a factor for our particular generation. You're absolutely right that it perpetuates the bias towards people from privileged backgrounds.

As for small world, I shared a desk with [personal profile] hmw26 when we were rising eight, and we were the only two Jewish girls in the year group pretty much the whole way through school, so we go back a long way. I didn't get on with most of her crowd in secondary school, so we weren't as close as teenagers, but I've kept an eye on her rather stellar career and we talk on FB sometimes. And her little sister suffered a spinal cord injury a couple of years before my brother did, so her parents were very supportive to my parents in dealing with that.
ext_8103: (Default)

[identity profile] ewx.livejournal.com 2014-12-13 05:26 pm (UTC)(link)
Nice retrospective! I remember the INT PI nonsense well.