Categories
Cosmography Technology

Hex Code

Well I suppose I’m a programmer now. Of all things.

It’s not what I expected, to be honest. I still associate the word with men in lab coats and bow ties in front of banks of flickering lights, doing arcane things at rattly teleprinter terminals. Something to do with rockets probably. Robots even. And punched paper tape!

Hippo

Punched paper tape was amazing, I used to collect discarded lengths of it from offices where my mother worked as a temp. Its perforated patterns are the perfect metaphor for the state of computing when I was a child. Pretty, delicate, clearly meaningful and yet profoundly mysterious.

These days? It’s writing really. You’re using language, a kind of language, to convey your intended meaning. Like much writing it’s part creativity, part drudgery and repetition. Long-separated senses of the word “hack” meet by surprise in a foreign city.

And like their natural counterparts, programming languages are a pretty diverse bunch. But you’ll hardly find two more different than the ones I just certified in – SQL and PHP. They’re like Choctaw and Chinese. Or more helpfully, Latin and English. One is (relatively) ancient, dusty and rule-bound, the other young and a bit anarchic.

Strangely though, it’s the old one that was actually designed to be English-like. And in the time of the lab coats I guess it seemed like it. A SQL command is called a “statement”, and is constructed much like a sentence:

Select roses, tulips from basket join bouquet where colour = "red"

Sounds almost like the real thing, doesn’t it? But…

Select camel, serendipity from D547 join moonslip where fandango = "buttocks"

…is equally meaningful. The resemblance to human language is superficial for a reason: In SQL there is only a handful of verbs, representing the very limited set of things you can do with items in a database. Its ‘nouns’ are little more than arbitrary labels. Real language is almost immeasurably more complex than that.

The thing that makes SQL seem completely unnatural though is its obsession with data types. These are important up to a point of course. You need to know what kind of data you’re dealing with, whether it’s numbers, “string” (which is what programmers like to call written words), dates and times, or more exotic stuff. You can’t add a word to a number or multiply a date.

But in SQL these break down into seemingly endless subtypes: For a number you need to know what the base is, whether it has a decimal point, if it’s positive or negative. With words it matters what the language is so that the right characters are used, plus you need to know what alphabetical order is for those characters, whether case is significant and so on. Dates and times are available in a mind-bending range of formats, depending on, say, whether you’re more interested in events since 1,000 AD or 1970.

Where it gets ludicrous is that there are still further subdivisions, into units of different size. (My favourite is called the Binary Large Object – or for short, BLOB.) The idea was to set aside only as much space as your data is going to need. If you have a column wide enough for six-figure sums and then enter numbers in the hundreds, you’re effectively saving blank decimal places to your hard disk. In the ’70s, disks were expensive. There was no room for empty space.

Compared to this, PHP seems like it was invented by hippoes. (I meant to say hippies there but I’m going to leave the typo in.) It’s just so… relaxed, skipping lightly over the very things that make SQL tedious. It seems to just guess what your data type ought to be. “You’re trying to add a number and a letter together? No problem, let’s see what happens.”

What makes it even more like human language though is the fact that it’s “Object Oriented”. This is a big idea so I’ll leave the details for another post, but suffice it to say that like real nouns, an object in OO programming is meant to represent something in the world. As such it comes with its associated “verbs” (known as methods) that represent the actions characteristic of that object. So the things that exist in your program have hidden powers that you can call upon if you know the right words. Cool.

Perhaps the best comparison then is not with different natural languages, but with different specialised jargon. Moving from SQL to PHP feels a lot like leaving contract law to take up alchemy.

Categories
Cosmography Technology

Perky

Breast self-examination
The connection between image and text is tangential at best.

Wow. Doing an exam is like shoving fistfuls of drugs into your face.

Well, doing an exam after…

  1. Studying frantically in a sort of cold panic for over a week
  2. Waking up at 3 a.m. and not getting back to sleep until an hour before the alarm
  3. Rushing out of the house only to find that the car won’t start

… feels like messing your head up with all sorts o’ bad stuff. Stress, with the stress on stress.

I still don’t know what was up with the car. Yes I had checked it the night before and no, I didn’t leave the electrics on. It was the good new battery that saved me in fact, because as the last desperate throw of the dice I just turned the engine over and kept turning it over until finally, one cylinder at a time, life returned. Perhaps I’d flooded it on the first try.

So now trying to get to my exam through rush hour traffic on very little sleep but oh so much adrenalin. Made it as far as the campus with minutes to spare, knew it would take too long to find a student parking space so threw handfuls of change at a ticket machine. Ran up three flights, downed three cups of water, made it.

This was Java, at once somehow my most feared and enjoyed subject. The course had been challenging – literally half the class had transferred out – but I felt like I was beginning to grasp its rhythms and its symmetries. Some programmers dislike the language; I have little to compare it to but I see a beauty in it.

Java is perhaps the best known example of an “Object Orientatedlanguage. If I dare try to explain that in simple terms, it means that instead of being long impenetrable lists of instructions, OO programs are made up of small units that attempt to model real things. A program with cars in it, say, would contain a subunit (called a “class” in Java) to represent cars. It would have its associated variables – colour perhaps, size, top speed – and “methods”, which represent what a car does: accelerate, brake, etc. They can be as elaborate or as simple as you need, but cars will exist in your program as discrete entities that can interact with other entities like passengers or junctions or other cars.

You can define subclasses that have things in common with some cars but not others, like 4x4s. Or superclasses – for example, one of vehicles – that comprise cars and other objects. In this way you clarify the relationships between things; you also avoid having to write the same code over and over, as subclasses inherit features from their superclasses. “Accelerate” for example need only ever be defined once to be used by every sort of vehicle. All these knit together in careful, logical ways to represent and simulate how things in the real world can interrelate. It’s elegant and subtle.

And elusive at times. So I worried that my understanding of the concepts was still quite tenuous and that an unexpected question might blow a hole right through it. But I think the exam went well. One good thing – I started at full speed, and stayed at full speed for three hours. All right, some of the answers may have been a little “Ooh, here’s another thing I remember!”, but I think I displayed a thorough understanding.

Unless of course I don’t understand, in which case I will have displayed a thorough misapprehension. To find out, we must now wait till autumn.

This is all over by 12:30, but the rest of the day is not without incident. Get some things I needed done done, fetch and carry, all in a strange trance of excess energy. I make it home eventually. The idea is to have an early night but I am as wired as I’m tired. It’s one in the morning before I finally – joyfully – go to my bedroom and reach to turn on the light.

And step in something wet.

That is never good. That is never never never good. It’s not much good in a bathroom or a kitchen. But in a bedroom, stepping in something wet is right out.

There is a puddle forming on the floor. The computer I’m building is sitting there powered up to standby, so it’s just as well I “went to bed” when I did. There is a drip from the ceiling. Deftly turning off all electrics and water with a single move, I fetch a ladder and squirm into the attic.

It’s coming from the complex pipework linking the three tanks of water in the attic space (I do not know why there are three tanks of water in the attic space). It is dropping directly onto a box of my personal memorabilia, and from there through the floor. After cutting away some of the nice new insulation I find a weeping joint. I fetch tools and tighten the fitting, squirm out and turn water back on.

Leak much much worse bugger.

Opening offending joint, I find that yet again a pipe has eroded. Don’t know what’s doing this, but it’s maybe the fourth instance of spontaneous dissolving pipe in the last couple of years. What the hell are we drinking? Spend the next hours crawling around in the dusty, glass-fibery, spidery dark doing work almost utterly unlike the pure cerebration of the morning, so tired now that – mercifully – I can’t even feel how tired I am.

Quite a day.

Categories
Humour Technology

What I Did In School Today

FirstDay - Copy

Seriously, we did this in class. OK, a lecture. It brought me back to a very different, though in some ways surprisingly similar, but mostly different school I went to many years ago.

I drew a house there too, maybe on my very first day. It’s certainly one of the first things I remember. I distinctly recall having trouble making the place I finished drawing the roof be the same as the place I started. Triangles are the hardest basic shape.

I recall my contempt for the children who drew their square windows in the very corners of their square house. Imagine that! Had they no powers of observation? Obviously the windows should be a little bit in from the corners. I mean, otherwise you’d see the edges of  the side walls through the glass. Sheesh.

The biggest difference is that I drew that house with a pencil. Today in school we drew houses with the Java programming language. It’s harder, drawing your house with the Java programming language. For example, at the age of four I didn’t spend a weekend staring at my pencil and paper going “How the **** is this supposed to work?”

So you’re seeing here the first thing I ever made in Java. I really do feel a little like a small child in school again. At the end of the class I printed it out and gave it to the teacher.

Categories
Cosmography Technology

A Walk In The Bog

Nesting swans

Web design with Drupal is weirdly impressionistic. Even after turning off all the parts of it I’m sure I don’t need – well, almost sure – there are still so many options and switches that I really can’t hold them all in my head. Maybe one day, but not yet.

And it’s difficult to know what consequences changing any one of them will have. It may achieve the goal of fixing an annoying behaviour, while elsewhere making half the site drop off. So progress has been a slow mix of careful testing, frantic searching to find a setting I know I saw earlier, installing several new modules in a vain attempt to gain one missing function, and just pressing buttons randomly to see what’ll happen.

All four strategies work about equally well.

So I went for a walk. Partly to take a break from this madness, but more because I’m still in mild but constant pain. To the point where I’m just annoyed with myself now. Even if I’d done nothing more than occasionally walk around a bit I wouldn’t be so prone to back injury.

My excuse all winter was that it’s just too wet outside to walk. But is it really? It doesn’t rain every day, even here. And there’s no shortage of roads worth walking, even a canal that goes right past the village. Our own canal! Built in the 19th century to drain the bog. I don’t think it works, but it teems with wildlife, and it is full of sky.

So some Desolate-West-of-Ireland pics:

One of my favourite trees

If I had a rowing boat, I wouldn’t leave it face up in the rain

Sky. For you. In the sky.

%d bloggers like this: