/* */

Category Archives: languages

Head of the GNU gnu

Old-School Coder

I have friends (no really! I do!) who poke fun at me for being so old-school with my text editor setup (I’m looking at you, Pyke). I make no attempt to conceal my affection for emacs. I have it nicely customized, just the way I like it – in fact I probably put more time and effort into customizing my editor than I do into customizing my living quarters. But I just realized today that I’m genuinely old-school in my coding. I code in *pen*.

I’m sure that my upbringing has something to do with this. My father was in senior management at Northern Telecom, back in the ’80s (back when they existed!), and before that he was a coder himself (in PL/1, APL and Fortran… *shudder*). I remember him bringing many of his employees to our house for dinner, and some of the earliest dinner discussions I can remember are about core leaks and stack overflows and such. And I remember one programmer in particular; I’m sure there’s one like him in every company, the oldest and smartest guy in the room, who more or less does his own thing until people find a completely intractable problem and bring it to him, whereupon he looks at the problem for a minute, tilts his head to one side, and writes out the solution on a napkin. The difference with Des, though, is that he would write out fully implementable (and commented!) code on that napkin. So that’s what I grew up thinking a “proper” programmer looked like.

Well, I’m certainly not a “proper” programmer. I *like* programming, and I sure do a lot of it, but I’ve got zero training in it (I took one computer class – “Fortran To Wash Out Wannabes”, I suspect it was called, and it worked!), and I’m the first to admit that I know diddly-squat about coding. But I really enjoy it. I like languages (both human and computer), I like math, and I like puzzles, and coding is the intersection of those three sets. But I don’t know enough about *any* programming language to just sit down at the keyboard and bang out a program. So what I do is, I think about a problem for hours or days at a time, and then I get out my pen and I write my code. The code is generally wrong, and will get crossed out and scribbled on repeatedly, but I still do this almost every time. Only when it looks reasonable on paper do I enter it into emacs and then try to run it. (That’s when the weeping and wailing and gnashing of compilers happens, of course.)

What I *don’t* do, is code by “Googling StackExchange”. Sure, I spend a fair amount of time on StackExchange looking things up, but since I’m not coding for a “real job”, but rather for the fun and challenge of it, I want to know why each bit I find works, and how to make it bend to my will and do what I want it to. And since I have no computer programming training, that means having to take apart every line, every clause, every idiom, to see what makes it work. I’ve written a set of routines for emacs to make this easier (essentially tools to uncompress commonly compressed web code), but when I really want to see how something works, I write it out in pen. Then I can go at it just like I would parse a difficult bit of Latin, by circling parts, drawing arrows to other parts, crossing things out, writing superscript notes… and eventually constructing my own sentence to make sure I understood it. All in pen.

Needless to say, this doesn’t get me invited to a lot of hackathons. What young, lean, agile code-bro has the patience to put up with the old guy who uses *actual books*, and is busy scratching away in pen trying to figure out what the program is supposed to do before he even starts up his IDE? I mean, he probably doesn’t even have any Reputation on StackExchange!

The funny thing is, when I’m writing a blog post, I actually *don’t* write in pen. I suspect that’s because when I write code, I have to write slowly, which forces it to be almost legible, whereas if you have any doubts that I’m a highly-educated person, well, you should try to read my handwriting. When I’m actually writing prose, my handwriting is beautiful and elegant and completely illegible. There are a few people out there who can read my writing, but most days I’m not one of them. So right now I’m writing this (of course) in emacs. I can tell you’re surprised 😉

So if you started reading this post wondering what I code, I’m afraid I’m going to disappoint you on that score… until another time, that is. Well, for the intensely masochistic among you at least.

Computer Music

My last few weeks (aside from a stint making a new Heather Dale record, and then a week taking care of my brother’s farm) have been largely spent devouring everything I can learn about computer music. This has involved a couple of substantial tomes – the Computer Music Tutorial and The CSound Book, for starters – and more PDFs and inline/online tutorials and manuals than you can shake a stick at. In a way it feels like I’ve found an amazing toolbox and am now looking for a problem to solve with it…

As my faithful reader(s) know, I do a lot of my composition and production work using Ableton Live. In a number of ways it’s a gateway drug, since it opened my eyes to the possibilities afforded by Max/MSP, and thence PureData and CSound and a pile of other things. But of course it’s not all roses.

For one, Ableton & Max/MSP are commercial software. For the most part I have no problem with this – I certainly don’t object to paying real money for carefully written, well-maintained software, which Ableton and Max both are. My main concern with unfree software isn’t the price, it’s the end-of-life and planned-obsolescence situations. I’ve been burned by EOL’d and obsolescent music hardware and software often enough that I’m a bit gunshy. Also, I like OSS because I like to tinker and prod at things and find out how they work. I wouldn’t know nearly as much about fiddles and guitars and pianos and amplification if I hadn’t had the chance to take them apart and see what makes them go (sometimes they tick… sometimes they go back together with all the same pieces… sometimes, not so much). But “no user serviceable parts inside” or a closed code base just irritates me.

So here’s the dilemma: Do I keep working with Max/MSP, which is beautiful software and integrates exceptionally well into Ableton (via Max4Live), and accept that I’ll be paying for often only marginal improvements and dealing with closed source, but a big, healthy community, or do I put the time into learning PureData, which can do pretty much all the same things, but is less pretty, less tightly integrated, and which is open source? And either way, do I put the time in to figuring out the insanely récherché MSP objects, or just learn the (equally insane but possibly more flexible) CSound objects?

And why don’t I just use the perfectly good synths offered by Ableton and Reason, and my remaining physical synths, and get on with it? Well, the answer to that is obvious – I have to learn and explore or I just lose interest entirely. So that’s not even a real question.

The real question, though, is “what am I going to make at the end of all this?” And I still don’t know the answer to that, any more than I understood why I took apart my first Gibson two weeks after getting it, or my latest amp 3 hours after getting it. I just have to take things apart and see how they tick in order to have creative ideas about how to use them*.

 

*This does not, I remind myself, extend to date night 😉

Coding

It may surprise some people to hear that computer science and coding are hobbies of mine. It’s particularly amusing since so many people who buy my* records and see me* in concert are programmers and computer scientists, who play music for a hobby. It’s kind of a nice mirroring, I think.

This is not to say I don’t get paid to code. I’ve run a number of websites, in whole and in part, over the years, so I’ve written my share of code – but that no more makes me a “professional coder” than the fact that I’ve written quite a number of contracts makes me a lawyer. It’s just one of those things you have to do when you run your own shop.

This past month or two has come very close to damaging my enjoyment of coding… security breaches will do that. Having to spend my time rebuilding stuff I’ve already built is about as much fun as having to re-record an album whose masters were destroyed. Not that I’d know anything about that… Ugh.

But it did get me thinking about what I enjoy about programming, and what I don’t enjoy about it. I enjoy the interesting, experimental parts of it – I dislike the parts that seem like work. No surprise there! Software engineering – bleargh! Trying to get someone else’s CMS or framework doing what it’s supposed to do, but doesn’t? Ack. Wrestling with libraries and documentation to try to find the exact syntax for someone’s stupid code? Yigh. Looking at needless boilerplate? Barf. If I’m going to do something that other people get paid for, I might as well have fun with it!

In some ways, what I enjoy is broken down by language. Java, PHP, Perl, C#, .NET? These all feel like languages & environments I should be paid (handsomely) to read, let alone write. PHP gives me hives. Perl makes me run for my flamethrower. Java & .NET make me think of Office Space. I’d rather write TPS reports than do that. No, really, I would. Ask me some time about the TPS reporting system I had to design for Canadian Tire. Argh. Yeahhhhhhh, I’m going to have to ask you to go ahead and kill me now.

But Python can be fun, for quick and dirty sketching of things, and writing occasional little utilities. JavaScript has its good parts, even though for the most part it feels like I’m sitting in a room full of hipsters trying not to punch them. C? I actually enjoy C, for some godforsaken reason (probably because Kernighan and Ritchie are such fabulous writers). Assembly language is fun, in a psychotic way, and I never felt like I “got” computers until I wrote my first boot loader & primitive operating system for a 386. (Until then I had no reason to believe it wasn’t just magic and imps in a box). And there are domain-specific languages that are fun – Max/MSP, PureData, Processing, CSound, LilyPond… there are obvious reasons why I like them.

But the one language (language family?) that I’m actually passionate about is Lisp. I remember the first time I found a copy of “ANSI Common Lisp” in a library. I looked into it and it looked like the code wasn’t even code, like it just said
  (do stuff (stuff)
    (do-it now
      (do-it right-now)))
And since the only programming language I’d used at that point was BASIC, my brain said “That’s not even possible! Where’s the code?” I was hooked. I love the elegance of the language; I love the syntax – or lack thereof – because I find I can never remember the niggly details of a language’s syntax; I love the feeling of taking a problem that would take hundreds of lines in another language and solving it in a handful of concise, easy-to-read lines of lisp. I’ve tried Clojure – which seems to me to be Java dressed in lisp clothing – and Scheme – which is super fun but not quite perfectly aligned with my way of thinking. For the moment I’m mostly working with Common Lisp, which has some rough edges (but then so do I) but is all around an amazing language. I’m trying to resist the temptation to re-implement everything in Common Lisp. Including WordPress…

I’m a tinkerer by nature. None of my instruments are stock, they’ve all been modified in one way or another. I like everything to be just the way I want it… and I never know what that will be, or whether it will change in a second. As a result, OSS, emacs and lisp are a natural fit for me. Besides, I’m a middle-aged recluse with a long greying beard, what the hell do you expect?

(*Obviously I mostly mean “me” in the sense of “me with the Heather Dale Band” and “my records” in the sense of “records I make with Heather”)

(**Dear gods my habit of parenthetical writing is getting worse the more I use Lisp (although of course it was pretty bad before (before what, you may ask!))).

Beginning Russian

Arbitrary Russian text

No I don’t know what that means. Why do you ask?

Some of you might not know that one of my hobbies has long been languages.

Like most Canadians, I grew up with at least a modicum of bilingualism (that’s right – I’m a Deschamps and I also speak English! 😉 ) Then in high school I had the option to take German… which I didn’t do. What I did take was a bit of Russian, as we were hoping to go on an exchange to the Soviet Union (yes I’m old shuddup shuddup). Then I got to university, where I took Greek (yay!), Latin (argh!), and eventually wound up teaching myself Old & Middle English, Old French, Old Norse, some literary Chinese and a certain amount of Moeso-Gothic one particularly boring afternoon. In short, I collect languages.

(I came back to German because it was necessary for a Classics degree, and my German TA was the spitting image of Debbie Harry. Mmmmmmm.)

So for no good or convincing reason, I’ve started studying Russian again. I’ve got some books (chiefly the Penguin Russian course, thanks Julie!) and some audio courses, and I’m enjoying every  minute of it. It’s a hard language. I mean, I’m down with inflected languages, and different script systems, but Russian has some evil complexity that I just love. (Prepositions without vowels? Right on!)

So today I’ve made myself a schedule, a syllabus of sorts, to try to keep myself on track with this adventure. It’s ambitious, but so is the whole endeavour, so why not, right? I’m looking forward to reading some Russian stories (maybe not Zamyatin and Solzhenitsyn just yet) and watching Russian movies (yay depressing death-filled apocalypses!) in the original sometime soon.

PS note to self: when switching the keyboard to Russian, remember to switch it back to English before editing the metadata for a post :S