Thursday, July 18, 2019

On resilience

I'm "on the bench" at the moment, so I've been catching up with my reading. Resilient Web Design, by Jeremy Keith, is an online book, a very elegant one I must say, that I'd come across before, but I thought I'd go over it again. When your job requires you to spend time in the JavaScript frameworks trenches, it's good to step back and get a bird's-eye view of the whole web design circus from time to time. In any case, you have to love a book that uses The Book of Kells to make a point about web design.

Near Kamaroti, Laganas Bay
Not so resilient. On the other hand, at least it's still standing, kind of. Near Kamaroti, Laganas Bay

The book goes over familiar web philosophies such as Mobile First, Responsive Design, Progressive Enhancement, and Feature Detection, and it explains the history of how, first JavaScript, then AJAX took the web by storm. Along the way Jeremy (if I may be so bold) relates the sorry, misguided attempt, in the form of XHTML, to strip HTML of its superpower - its tendency to stay calm and carry on in the face of errors.
"[XHTML]'s theoretical purity was roundly rejected by the people who actually made websites for a living. Web designers rightly refused to publish in a format that would fail completely instead of trying to recover from an error."
Despite all that, the fragility of today's JavaScript world means we all seem to have forgotten the reason HTML conquered the world in the first place (I'll accept my fair share of blame for that).

One thing in particular, though, resonated with me as I read the book this time around. In the second chapter, Jeremy talks about the principle of 'material honesty', a phrase he borrows from the world of architecture. This principle counsels against using one material as a substitute for another. Use things the way they're supposed to be used. Stop using HTML tables, which should of course only be used to present tabular data, to layout your pages. Use CSS instead. Of course, this hasn't always been that easy, but it sure is now. But that doesn't mean that most devs are using CSS Grid, for instance. Or rather, they may well be using it, but they're doing so indirectly. By, for example, handing over control to a layout framework like Bootstrap or Material.

Like everyone else, I've used Bootstrap's grid system to get around the problems of responsivity for years. In that time I allowed myself to become completely reliant on it, and to instinctively write the bloated, div-happy HTML it requires. But I've always tried to keep up with developments in CSS that relate to layout, like Flex and Grid, along the way. Now CSS Grid is here, and there's no excuse not to use it. I notice, however, a lot of devs curiously unequipped to make the natural move of adopting it, and in so doing throwing out Bootstrap, or Kendo, or whatever they use. Why? Why don't they want to do their layout with the honest material of CSS, getting clean HTML in the process? I think it's because they've learned to be helpless. Constantly using frameworks to do what you could do yourself has just made them Bootstrap developers, not web ones (no doubt it's the same with me when it comes to some of the JavaScript platforms and libraries I (over)use).

So, I don't know if this particular gripe of mine has much to do with resilience per se or not. I do feel, however, that this lazy dependency we have on third party frameworks for basic layout, not to mention the breeding of developers who barely know anything about one of the most exciting developments in CSS, one of the three core technologies of the web, makes for more complicated codebases, as well as code that varies from project to project, with Material here, and Bootstrap there, when a web standard for layout now exists. And excessive complexity and a lack of standards adherence are not going to make for a resilient website.

Friday, February 27, 2015

Three Days in Melbourne

There’s something sinister about rain on a Saturday morning, something inauspicious and perverse. You have a right as a working stiff to expect something more magnanimous from the fates, but on the Autumn morning that Tina and I touched down in Melbourne for a three-day jaunt, we felt harshly done by by whatever deity handles precipitation.

We got picked up by our friend Lex, who was our host for the weekend, in a car which, not to sound like an ungrateful bollix or anything, had an abundance of dog hair in the back. But no matter: in Fitzroy the shopping started immediately. Being all into languages, I had sussed out Bookery, a foreign-language specialty librería (a much better word than ‘bookshop’ in anyone's language). I made my way there, just off the café strip of Brunswick St., while the girls hit the hat shops hard.

In the French quarter (of the shop) I got chatting to an Irish guy called Brendan Mooney, to whom I delivered my whinge du jour: the lack of any Irish language activity north of the border in Queensland. He told me all about Cumann Gaeilge na hAstráile (the Irish Language Association of Australia). Other than GAA, financial difficulties, and the St. Patrick’s Day parade, there's nothing happening with the Queensland Irish Association that I can see that has anything to do with Irish culture, and certainly nothing to do with the language itself, so that was good to hear about, even if the Cumann’s website seems a bit banjaxed.

Off Flinders St
Off Flinders St.

Striding back through the pissy drizzle to grungey Brunswick St., I reflected on how it always feels a little strange to switch to Irish mode like I’d just done, having effectively suppressed my accent for so long. Mooney’s accent had impressed me, but I felt mine rose to the occasion in response: a fair man would have to call it a draw.

In Balaclava Lex asked us “Can I show you my favourite accessory shop?” Under normal circumstances those words would have had a sobering, nay, chilling effect on me, but we’re Brisbanites in Melbourne and are expected to go shopping in Melbourne. I ended up splashing out $60 on an authentic New York flat cap made in China in a shop called Carlisle Accessories, posing at the counter while the woman took a photo of me for their facebook page. I hate facebook, but it would have been poor form to have pressed home my aversion just then. (I checked on my phone later that evening, crucified with a headache, and yes, I actually was on their facebook page, radiating happiness.) Rarely do I buy clothes, even less often do I buy “accessories”, so it seemed like a good idea to commemorate the event by posing alongside some edgy Breaking Bad urban art on the wall.

Saturday passed, and with it my headache. A righteousness of older cyclists swept past me on the cold streets of Sandringham as I took an early Sunday morning constitutional, although I’m hardly one to talk about anyone else being old having just turned 47 myself. If Saturday night belongs to lovers, then Sunday morning belongs to cyclists. Walking, I felt like I’d backed the wrong horse.

Tina joined me for a flattie (Australian for 'flat white', which is Australian for coffee with milk) on Hampton St., the disappointingly quiet main drag, although I rescued the situation by exchanging a few bon mots with a woman in a French deli next to our café. Language practice is like the shopping channel on TV; it's always on, always available if you want it, and I will always take the opportunity to talk French to someone who has placed themselves in a linguistically vulnerable position such as being surrounded by baguettes and fancy fromagerie in a shop called Au Bon Pain or quelque chose like that.

Posing with my new cap beside Heisenberg

And here’s another bona fide traveller tip, albeit on a different topic: almost every time you go away somewhere on a short break, a well-meaning friend will offer to drive you somewhere so you can see more in the short amount of time you have there which is all very well, but you'll end up spending most of your time looking out the window while they drive you to this amazing place or swing by that amazing place. You might get to cover more ground and “see” more, but it’ll mostly be from the back seat (just think of all the dog hairs) of their car. Say “No, thank you.” and think bicycle instead. So we nipped that one in the bud early on, and had told Lex we wanted to cycle around. She had two good bikes lined up by the time we got back from our morning coffee, and before we could cool down again (this is Melbourne in May, remember) we shot off, cold as you like for a sunny, flat, meandering, hour-or-so-in-length, shore-hugging, brilliant-in-every-way ride to St. Kilda.

When we got there, we felt great. It was the exercise, the being-on-holiday feeling, all that. Carelessly surfing a wave of joie de vivre, we spent money on a picture of a famous laneway in the CBD we would in fact end up having breakfast at the next morning (see the picture below). Not that we knew that then, we just liked the composition. The photographer was curiously indifferent to the sale in the manner of great artists and poor salesmen.

We proceeded to mosey. At the foot of Acland St., the street famous for its cake shops, I had to smile because across the road from us was a place called Hill 16, with that name surely an Irish pub. I’ve never been to the real Hill 16 in Dublin but this would do handsomely. Over a Guinness and a Magners I caught up on my social media posting, tweeting, and checking in.

After lunch with some friends, we took a stroll along the frontage of St. Kilda, definitely one of the quintessential Melburnian things to do, especially on a Sunday afternoon. Sitting on the wall at the edge of the boardwalk, half-watching our friends’ two young kids playing in the sand of great old Port Phillip bay, a real feeling of mellowness settled in my lap like a pussycat. This was the apex of our weekend away, Melbourne was the sun and we were at perihelion, even the coffee in my hand was the best I’d ever tasted. Then one of the kids got scared by a sand-spider or something and rushed back to us, howling, shattering the tranquility like an ambulance. Three miles to the right, the skyscrapers of Melbourne were as clear as an LCD screen.

That night we were in there, right in the heart of things. The Chinatown here is much bigger than the one in Brisbane, the one I happen to go to most days for lunch. It’s Sunday night, and you get these young women standing out in the cold, poor things, promoting this Malaysian Satay joint or that Hokkein Palace, cruelly at odds with the warmth and humidity of those far-flung places themselves. It was to be Malaysian tonight, Tina and me acclimating ourselves for our imminent trip there with Nasi Goreng and Laksa.

Degraves Espresso
Degraves Espresso

It’s our last day at last, and to my surprise it turns out that in Melbourne, you can sit at a café table in one of its famous laneways and ejaculate a cloud of fag smoke while others - us - are trying to enjoy their breakfast at the next table. Instead of annoying me though, when I gave it some thought it reminded me of a time my Dad and I were driving, yonks ago, in Cornamona, near the Galway/Mayo border. We pulled in at the only pub in town; he thought he’d nip in for a quick one, to break up the driving, and enjoined me to come in too and check out the lads (men, that is) blatherin’ away as Gaeilge. It was a fast disappearing scene, he said, it’ll soon be gone, but I was sixteen and not in the least interested in stuff like that. I sullenly let him go in, disappointed, on his own. My Dad’s dead now, and I only wish as I sit here that I’d gone in for that coke. Anyway, my point is that nowadays instead of being irritated at smokers at the next table, I perversely take pleasure in it, because it reminds me that the fate of this once-ubiquitous but now fast-disappearing custom, is surely to go the way of farmers talking Irish in Cornamona.

It’s been a grand weekend. On top of all I’ve already mentioned, we saw a medieval earthquake predictor at the Chinese Museum which was much more artistic and imaginative than it needed to be considering its function was just to tell you that the ground was shaking. We also met a Abu Dhabian guy called Mohammed on the plane home who was on his way to Brisbane to take up a job with KPMG. He had had to shave his beard to get the job, he told me in almost perfect English, albeit American-tinged for some reason, and confidently expressed the opinion, at a blissfully unselfconscious level of decibels, that Qatar’s putative 2022 World Cup stadium looked like a giant vagina, which apparently is old news. Well you live and learn.

I called Mohammed up to meet us at the Paniyiri a few weeks later, and that was the last time we met, sitting on the benches in Musgrave Park drinking Mythos and talking crap. I hope his job is going well, and that he’s adapted to Brisbane: it must be quite a change from what he’s used to. As for me: well, now that Melbourne was behind me, it was time to start dusting off my beginners’ Behasa Malaysia book in time for my trip there in two weeks’ time.

Tuesday, December 9, 2014

5 major language anti-patterns

I’ve noticed over the years a few common misconceptions people (especially me, until I learnt better) have with languages they’re not familiar with. Like computer programing antipatterns, these bad ideas can often be grouped and given a funny name.

Imagine a sailor on the Spanish main who accidentally dropped a waterproof bundle of his possessions over the side of the brig and expected to find the same bundle years later at that exact same spot, bobbing up and down, without having moved in the interim. That would be bizarre, you might say, while also observing that it’s quite improbable such a thing would ever happen given that a sailor, of all people, would be expected to appreciate the power of wind and ocean currents. Never mind that for now.

If it was just one sailor you might think that they were affected by some mysterious ague and forget about it. If it came up again and again though you’d probably want to put a name on this pattern of behaviour, something like 'St. Tibald's Fever', just to make it easy to refer to it now that a few people were afflicted with it. You might even call it an ‘anti-pattern’.

Anti-patterns are a thing in computer programming and web development, my particular field. They are wrong ways of doing or thinking about things, commonly done. They often have vivid, descriptive names like 'lava flow', 'cargo cult programming', and 'golden hammer' that make you want to find out more. When you do you realise (if you're in IT) that not only do you recognise the problem, you're actually 'lost in the weeds' yourself, or, worse, in a 'death march', with ‘God objects’ and 'poltergeists' everywhere.

When we programmers get together, we find it useful to refer to these bad practices by name like this to spare our friends having to listen to a five-minute tirade about the messy code at work, where you can't find anything and things are just put anywhere willy nilly, and why is that file there, and this interface here, and ... "Oh you mean it's 'spaghetti code'?"

It seems to me that this convention would be useful in the similar domain of language learning. If the same mistakes, broadly, are made over and over by people, then a nomenclature system can be useful to help identify them, or at least to shortcut the process of talking and writing about them. In case this already exists and I'm coming late to the party, I apologize. In case it doesn't, splendid, let's continue. In either case, here are my proposed anti-patterns.

Howard Clifford running off the Tacoma Narrows Bridge during collapse, Tacoma, Washington
Howard Clifford running off the Tacoma Narrows Bridge during collapse, Tacoma, Washington, Flickr

1. Argumentum ad Exoticum, or "Those Crazy Chinese"

Faced with a deeply unfamiliar set of characters, like Chinese ones, people begin to form some strange ideas that borrow heavily from craziness. Just because the building blocks are a different type to our own doesn’t mean that most of the basic concepts of communication, like words for example, don't exist. Yet this is exactly what I've heard from someone I know, someone interested in languages, namely that Chinese doesn’t have words, and I’ve argued against this if only just to keep the net amount of sanity of the universe from dwindling more than it has to. Not on my watch and all that. "I just read on Wikipedia (an attempted Appeal to Authority right there) that they don't have words, just characters. Just because we have words doesn't mean every language has to have words you know."

I asked my friend to think of a bazooka in his big fat head, and imagine two Chinese people discussing whether they should purchase a new bazooka. What in God’s name did he think they use when they’re talking to each other about shoulder-launched munitions if not some word thing corresponding to the word thing we’d use in our language to mean ‘bazooka’? Do they whistle instead? Or mime? Or all jump up and down at the same time and cause a tsunami? Chinese has words in the same way we have words: arbitrary assignments of sounds and signs to represent things in the real world, often made up recursively of more basic sounds and signs.

Or do they? The strangest thing was that even though I had been studying Chinese for a while, I began to doubt my own certainty that Chinese had words, such was the vehemence of my friend’s objection. Because we trade in words in English, had I simply assumed that things like 孩子 (child) and 你 (you) were “words”? They don’t look like words, really...maybe they’re not. I was feeling the cold hand of exoticness on my shoulder.

I shrugged it off. Of course they effing well have effing words! They even have a handsome word for word: 词. I have since decided that I should have more faith in my own studies, and have sadly given up on my friend as being willfully obstinate and abstruse when it comes to unfamiliar concepts. Chinese will stretch you as a language learner if you’ve only done Indo-European tongues before. Don’t be put off by appeals to exoticness from a starting point of ignorance, and above all use your common sense.

2. La Carte et le Territoire

I read a book a few years ago in French by the bête noire of belles lettres Michel Houllebecq called La Carte et le Territoire, whose title I want to use here to highlight a confusion between a map and its territory. For example, just because in Spanish they use the word “gerundio” doesn’t mean that the word “gerund” maps to the same thing in English. If you think this, as I did until recently, then your map is slightly out and you need to redraw it. I got into a kerpickle on Duolingo about this very misunderstanding. I thought the map was the territory. But there are kinks; it’s not a straightforward mapping at all.

In English a gerund is more than just the form of a verb ending in “ing”. It’s only a gerund when that word becomes a noun, like “The Taming of the Shrew”. “Taming” here is a verby noun. By the way, don’t use that term (“verby noun”) around language people. This sentence, this one, on the other hand, as well as being a bit contrived, does not in fact have a gerund. In Spanish however, las cosas son distintas. Even though the word gerundio also refers to a verb in “ing” mode such as “esperando”, or “andando” it doesn’t need to be a noun to be a gerundio.

I got schooled on Duo by people who knew this when I didn’t. I naively assumed that gerundio was the point on the Spanish map corresponding to the concept of an English gerund, and that therefore they were conceptually identical. Maps are handy, but they’re not the territory.

3. Function doesn’t always follow form, or "It may well walk like a duck and quack like a duck but it’s actually a rhino"

Have you heard about those Myrmarachne jumping spiders that have evolved to look like ants? They resemble the little critters to such an extent that they insinuate themselves into the ants’ business and then turn on them, all unbeknownst like. In the animal kingdom that’s called Batesian mimicry. In Greek it’s called ‘deponent verbs’. You have this species of verb which has evolved to pass itself off as a reflexive-looking verb, complete with pronoun suffix at the end à la decidirse in Spanish. In some cases it has a passive, or reflexive meaning, as in ‘I am loved’ but all too often that’s a red herring and it‘s just a normal, active, common-or-garden verb. Έρχομαι means I come, χρειάζομαι, I need. No reflexivity or passivity there.

I got into a bit of a ding-dong with my Greek teacher Kelly when she tried to explain all deponent verbs like this to us as being somehow passive in meaning, if only in some cases in an underlying, implicit kind of sense. I pointed out that no matter how you slice it “I come” is not passive in English, and hard to see how it could be passive in Greek. Same with “I need”.

Confusion reigned, and she probably felt her authority was being undermined by an Irish smartarse, which it was. I felt the others’ annoyance from then on when I stopped the class and demanded to know more about stuff that didn’t add up (for all that, I was the only one who finished the course: the others had all dropped out by the end.) I wrote to the guy who wrote our textbook, Theodore Papaloizos, feeling that this particular aspect of Greek needed to be spelt out very painstakingly for English learners in particular. He wrote back "All languages have their peculiarities and Greek of course is not an exception. For a student of Greek it is difficult to understand how a verb looking and conjugated as a passive voice verb has an active meaning. Most of these verbs come from ancient classical Greek." It might be easier in other language pairings, but deponency is just cruel and unusual for us anglophones. Just because something looks a certain way, doesn’t mean that it behaves that way.

At one stage, in a bold manoeuvre by which she sought to outflank me, Kelly came in and told me that she had confirmed such and such a point about deponency or passivity by checking with her husband, who is also a Greek speaker (and in IT as far as I remember), therefore QED and shut up. She had unwittingly plunged headlong into the abyss of anti-pattern no 5...

4. Argumentum ad Naturalis Omnisciens

...which is the mistake of thinking that native speakers have some innate handle on the grammar points of their mother tongue. If you suffer from this delusion, turn to the person beside you at work and tell them you’ve forgotten when to use the subjunctive again, would they mind running you through the rules? And the forms the words take too. If they wouldn’t mind, like? Seeing all too clearly where I’m going with this you might say, alright, they may not know all the stinkin’ rules, but they’d surely know whether something sounded right. Ah, would that this was true, or..hang on... is that ‘were true’? I’m not sure.

And that’s English, with the world’s tiniest subjunctive and verbs that hardly move at all. Greek verbs flex like a prepubescent Russian gymnast, so the idea that Greek speakers can rattle off the rules of irregular verb formation, or the subjunctive, or the deponent stuff, I have found to be, well, laughable. My wife, with respect, rabbits away to her Mum in Greek. She proved to be of little or no use to me, God love her, when I was hitchhiking through the badlands of Greek grammar and got waylaid by delinquent local constructions.

5. Meaning, meaning, everywhere

An overarching misconception, common to several of these anti-patterns, is born of a failure to grasp just how arbitrary, random, and plain ol’ in flux much of language is. This anti-pattern manifests itself in the form of the old Platonic chestnut wherein, say, the building blocks of Chinese characters are seen to have such a rich, meaning-laden storytelling role in the language that when they are used as part of a character they bring that semantic basket of goodies they have preserved intact through the centuries with them. They might tell a little cautionary tale here, or proverb there, like the one my brother-in-law told me about the compound character where two of the ‘building block’ characters which ‘stand for’ a woman, all under a roof character, means strife or conflict. Because, you know, the wily old Chinese realised, chuckle chuckle, that having two women in one house would be like having a bag of cats. This I grandly call The Raconteur Theory of Chinese Characters. Alas, there is no deep insight into Chinese or the human condition to be found here: words and characters are just tools, not lessons.

Subscribing to 'Raconteur’ you are like someone who thinks we’re referring to horses when we talk about someone’s chivalrous behaviour simply because cheval means horse in French. Many a word’s meaning has moved on over the years in a process of analogical extension, blurring and Chinese whispers. You are like the sailor who expects to find his bundle bobbing in the same spot if you believe otherwise. You, sir or madam, have St. Tibald’s fever.

As anyone who’s studied the origin of Chinese characters knows, “there has been a progression from pictographic, writing the picture; to ideographic, writing the idea; and then logographic, writing the word” to quote James Gleick in The Information. Nowadays we’re just writing words, not necessarily ideas. Which means that in many cases, much as you might invite an acquaintance along to a party simply because he has a guitar and can sing, part of a Chinese character is there just for its sound: it’s as semantically void as a waffler’s promise.

There is a very human tendency to overexplain or retrofit explanations to try and justify something that’s actually just the way it is for no better reason than euphony (it sounds better) or historical contingency. You don’t want to confuse a mem, a way of remembering something, often involving a story, with the ipso facto thing itself. We like stories, but beware the Narrative Fallacy which says that stories are often the wrong causal explanation for something that may be better ‘explained’ in statistical terms. In fact, as far as learning words is concerned, the best explanation is often “that’s just the way it is.” Let it go at that without burdening a language with the naive expectation of logic everywhere, and be happy that they’re much more idiosyncratic and poetic than that.