Startling new proof that Ruby sucks at scripting!
Scripting languages should launch quickly, run at acceptable speeds, then exit quickly. Consider this script:
#!/usr/bin/env zsh
cat << SNOBOL4 > bogobench.sno
OUTPUT = "Hello, world!"
END
SNOBOL4
cat << REXX > bogobench.rexx
say "Hello, world!"
REXX
cat << AWK > bogobench.awk
BEGIN {
print "Hello, world!\n"
}
AWK
cat << RUBY > bogobench.rb
puts "Hello, world!"
RUBY
cat << LUA > bogobench.lua
print "Hello, world!"
LUA
cat << PROLOG > bogobench.pl
main :- write('Hello, world!'), nl.
PROLOG
cat << ERLANG > bogobench.escript
main(_) -> io:format("Hello, world!~n").
ERLANG
cat << JAVA > bogobench.java
public class bogobench
{
public static void main(String[] args)
{
System.out.println("Hello, world!");
}
}
JAVA
javac bogobench.java
/usr/bin/time -p ./bogoloop awk -f bogobench.awk
/usr/bin/time -p ./bogoloop rexx bogobench.rexx
/usr/bin/time -p ./bogoloop snobol4 -b bogobench.sno
/usr/bin/time -p ./bogoloop lua bogobench.lua
/usr/bin/time -p ./bogoloop swipl -q -t main -f bogobench.pl
/usr/bin/time -p ./bogoloop java bogobench
/usr/bin/time -p ./bogoloop escript bogobench.escript
/usr/bin/time -p ./bogoloop ruby bogobench.rb
rm bogobench.*
It’s simple enough: it generates the test scripts using here-documents. In the case of Java, placed as an example of a well-known start-up time hog, the test script is then compiled. The script is then run 100 times in a tight loop using this script:
#!/usr/bin/env zsh
max_iter=100
a=0
echo "Running '$*' $max_iter times…"
while [ $a -lt "$max_iter" ]
do
a=$((a + 1))
$* > /dev/null
done
echo "…done."
Very straightforward. And, of course, we’d expect a few things:
- Execution time should be negligible. All that’s being done, after all, is outputting a string, something scripting languages should excel at.
- SWI-Prolog and Erlang both should be pretty damned slow, given that they’re massive languages with massive run-time systems behind them (and in both cases the “scripting” is mostly an afterthought).
- Java, with its notorious JVM load time, should be incredibly slow.
Results
The two numbers that are meaningful in the time output are the user and sys values. Take a look at the raw results:
./bogobench
Running 'awk -f bogobench.awk' 100 times…
…done.
real 0.66
user 0.03
sys 0.03
Running 'rexx bogobench.rexx' 100 times…
…done.
real 0.36
user 0.00
sys 0.05
Running 'snobol4 -b bogobench.sno' 100 times…
…done.
real 0.52
user 0.00
sys 0.05
Running 'lua bogobench.lua' 100 times…
…done.
real 0.28
user 0.01
sys 0.03
Running 'swipl -q -t main -f bogobench.pl' 100 times…
…done.
real 2.40
user 1.32
sys 0.70
Running 'java bogobench' 100 times…
…done.
real 12.03
user 8.75
sys 2.00
Running 'escript bogobench.escript' 100 times…
…done.
real 18.89
user 13.77
sys 2.46
Running 'ruby bogobench.rb' 100 times…
…done.
real 49.53
user 43.10
sys 3.74
Guh… what?!
Results
In EVERY SINGLE METRIC Ruby came in slower—often by two orders of magnitude!—than EVERY OTHER LANGUAGE. Let’s consolidate the results, adding together user and system time:
| language | time(s) |
|---|---|
| lua | 0.04 |
| rexx | 0.05 |
| snobol4 | 0.05 |
| awk | 0.06 |
| prolog | 2.02 |
| java | 10.75 |
| erlang | 16.23 |
| ruby | 46.84 |
Consider what this means. Lua is a better scripting language than Ruby in that it is just the fastest of the bunch while being easily as powerful. Rexx, a language made in the ‘70s on ancient, creaking mainframes is a better scripting language than Ruby in that, while it may be a little bit less powerful, it sure as Hell is faster at loading. (And how much power do you actually need for scripting?) Awk, too, another language from the ‘70s, is more than powerful enough for most scripting needs, and well within acceptable load speed parameters.
More embarrassingly, Prolog, a language not intended for scripting, and, further, an implementation that’s not noted for being quick, is almost acceptable as a scripting language, coming in a good twenty times as fast at loading as Ruby. Erlang, too, even though it’s a painfully slow startup, is over three times as fast as Ruby at loading.
Even Java, a language not intended for scripting and infamously slow at loading is almost five times as fast as Ruby (and about 1.6 times as fast as Erlang).
Ruby, it turns out, is worse as a scripting language than three scripting languages from as far back as the ‘60s, not to mention three languages that aren’t even really intended for scripting.
Versions
Lua 5.1.5 Copyright (C) 1994-2012 Lua.org, PUC-Rio
REXX-Regina_3.7 5.00 14 Oct 2012
CSNOBOL4 version 1.4.1 (January 19, 2012)
GNU Awk 3.1.7
java version "1.7.0_17" Java(TM) SE Runtime Environment (build 1.7.0_17-b02) Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)
rubinius 2.0.0.rc1 (1.8.7 release yyyy-mm-dd JI) [x86_64-unknown-linux-gnu]
Erlang R15B03 (erts-5.9.3.1) [source] [64-bit] [smp:2:2] [async-threads:0] [hipe] [kernel-poll:true]
Rage at Connecticut
There were two major events in the same year that had me questioning the sanity and the humanity of Americans during my time in China.
Rock my world
The first of these was the 2008 Sichuan Earthquake where great American luminaries like, say, Sharon Stone, opined that the victims of the earthquake somehow deserved to die or to have their lives destroyed because of the way the Chinese government treated Tibetans.
Were it only that overrated Botox® bimbo I’d have laughed it off, but all over my social media feeds of the time I saw people who seemed to be normal, decent human beings suddenly start spouting off exactly the same sentiments. The stunning hypocrisy, stupidity and inhumanity of these people had me exercising a lot of blockage. They fell straight into the “human sacks of shit” box and were buried from my social media stream forever.
The milk of human kindness
Even worse was the dairy scandal that broke only a couple of months later, however. Here, you see, I found similar seemingly-decent people suddenly spouting the homily that “the Chinese just don’t value life like we do”. Reading that from dozens of people from both the USA and Canada led to a severe adjustment of my opinions toward both nations as I watched everybody around me race to find safe supplies of milk powder (I got mine at tremendous expense from overseas, as did most others who could afford it) because they were afraid for the lives of the children whose lives they “don’t value”.
Keep that asinine, sanctimonious bullshit line in mind: “The Chinese just don’t value life like we do.”
No, seriously: rage at Connecticut
On December 14th of 2012 there was a horrific shooting at Sandy Hook Elementary School. It was one of many mass school shootings in the USA since the tainted milk scandal. The death toll for the tainted milk scandal was 6. The death toll for mass school shootings alone in the USA since then is over 50. (That’s mass school shootings, note.)
<sarcasm>I guess Americans just don’t value life like the Chinese do.</sarcasm>
Hurts, doesn’t it?
Do I seriously believe Americans value life less than the Chinese? No, not really. Of course not. I do believe, however, that Americans (and Canadians) have a very strong tendency to be smugly sanctimonious at the specks in other peoples’ eyes whilst ignoring the beams in their own.
Do you really want to criticize how “murderous” other cultures are? Take a look at your own violence statistics. (Let’s not forget the people you kill in your wars! Or the people your allies kill for you in their wars!) When you’ve looked into these, and taken in the shocking numbers (if you’re not shocked, you’re not human as far as I’m concerned!), then, maybe, you have the background to be sanctimonious.
I doubt you’ll be that smug afterwards, though.
Closing words by the Boomtown Rats
Thinking the unthinkable
I’ve been using Linux 99.44% exclusively for almost ten years now. In those ten years, however, I’ve developed an almost anaphylactic reaction to its total fuck-ups in the GUI world. Contrary to the almost annual promise “this year is the year of the Linux Desktop”, Linux has absolutely no future visible on the desktop for average end-users. The reason for this is obvious: contempt for the whole end-user experience is baked deeply into the genes of your average freetard developer.
As a result I’m thinking of flipping my machine.
Currently I run a Linux desktop (Linux Mint 11) for everything and fire up a VirtualBox machine for Windows XP for those rare times I need to use Windows specifically. I’m now thinking that it’s time to switch my main OS to Windows 7 and fire up a VirtualBox machine for those times that I need to use Linux.
WTF?! What led to this?
I tried to install a piece of software today. It’s a pile of fucking horse dung called KVpnc. Every step of usage is a serious WTF on a GNOME desktop. Take, for example, what happens when you launch it. Up comes KDE‘s “wallet” dialogue asking for permission to… do what, precisely? Who the fuck knows!? Freetard GUI developers seem to believe that “dialog box” is just an accidental name; that surely there’s no expectation of a dialogue with the end-user there! It just asks me for my kwallet password and tells me that KVpnc wants to use it. For some reason. That it won’t deign to tell me.
But that’s not the only piece of WTFery associated with this festering, manure-smeared outhouse masquerading as software. Because not only does the wallet dialog pop up, but so does another dialog box telling you that KVpnc wants to access the wallet, asking you if you want to allow it or if you want to kill the KVpnc application.
Two dialog boxes for one action. With no clue as to which should apply. Brilliant UX design there guys! (Before the reddit apologists and the HN wannabes chime in, I’m aware that the kwallet crap is part of the other festering pile of horse dung called KDE. This doesn’t matter. The point is that the UX is a horrible piece of stinking faecal matter. Where the specifics of the horror are implemented is of absolutely no interest to the user.)
Anyway, that alone isn’t worthy of me wanting to just give up on F/OSS desktops. No, what happens next is the reason. Because what happens next is that I try to import some settings given to me in an XML file. I sneaked a look at the XML file and it’s perfectly well formed. It has, to my quick eyeballing, a valid set of options. Too, it was made by exporting from a KVpnc instance that was the same version, so no versionitis is to blame. What did I get from trying to import that, though?
“error: Failed to read ”/home/michael/Desktop/KVpnc-connection.xml”
Yes, that’s all I got. “Failed to read.” No hint as to what the problem was. Permissions? Bad format? Doesn’t exist? Cosmic rays from outer space hit the CPU at just the wrong point? No fucking idea.
“Ah,” I said to myself. “This is just the traditional optimism of freetard developers. They can’t conceive of their code failing so they put in a catch (or whatever) at the topmost level and print a generic error message. Surely I just have to hit the web and find that error message and read what the problems could be.”
Boy was I a naive idiot.
Here’s a fun exercise for you. On Google search for “Failed to read” (with the quotes). I forgot that making stupid, meaningless, unhelpful error messages is an entire cottage industry in the F/oSS world. The old-school UNIX ethos of just saying “an error happened” has pervaded the culture to the point that even when software intended for end-users is made the whole “experts will undoubtedly know what’s wrong” meme takes over. Even searching for that and vpnc gets you nothing meaningful for help.
And that’s the problem.
In searching on this error message, I was reminded of the myriad of times I was faced with crappy software tools of all stripes, ranging from developer tools to end-user tools, whose sole approach to user interaction on error was to say “an error has transpired” and then nothing else. Then I compared this to my Windows XP days, short as they were, and started to reminisce.
Yes. You read that right. I started to reminisce over WINDOWS XP. (Shoot me now, please!)
And that’s how it stands now
I’m desperately trying to find a reason not to switch back to Windows. I’m trying to find a way to not use software written by poorly-socialized geeks who hold their users in contempt while still not feeding the Microsoft machine. (Don’t bother suggesting Apple anything. I will never purchase Apple kit. I find them too toxic an influence on the world of computing and software.) I’m trying, but really failing badly because the state of F/OSS GUI is so fucking horribly bad it hurts.
Maybe if I drink enough 白酒 tonight I’ll damage the brain cells that hold the memories of all this F/OSS UX shit and I’ll stave off the decision to toss away Linux for another month.
Why inbreeding is bad for your community
I decided to try out the Yesod Web Framework for Haskell today. I did this knowing full well that the Haskell/Hackage/Cabal ecosystem and infrastructure is almost gloriously broken. “Hey,” I thought. “How bad could they possibly make what is supposed to be one of the flagship packages showing off the strengths of their language?”
Very bad indeed, my droogs
The Cabal setup is fundamentally broken in Haskell. Packages in the Hackage database are extremely picky about their version requirements (which is fair enough, given that even bumping up a minor version number in a Haskell package frequently involves massively-incompatible API changes—apparently semantic versioning isn’t a thing in the community) and Cabal does absolutely no version management whatsoever. The only thing it can tell you is that if you install a package that will force a version upgrade that another package might get broken. (When you read these messages you might as well s/might/will most fucking definitely/g because I’ve never seen a case where an upgrade didn’t break another package insisting on a previous version.)
I made the mistake of trying to install Yesod after I’d installed a few other Haskell packages. Cabal flipped its lid and simply refused to continue past this point. Trying to force it, as expected, broke the whole ecosystem so badly I simply couldn’t get back to anything that worked at all.
Initiative comes to thems that wait
So, after a brief discussion with some nice, earnest people in #haskell (props to both ivanm and byorgey for your help!) I just decided to cut my losses and do everything from scratch. I mean it’s not as if I actually do any real programming in Haskell. (Mostly because of the Cabal fuck-up, mind, but still.) So off I go and delete $HOME/.cabal and $HOME/.ghc to start from a clean slate. I execute cabal update to get the package list and…
…wait…
…until it finally finishes. It suggests I upgrade my cabal-install package to the latest and greatest. cabal install cabal-install (this command line brought to you by the Department of Redundancy and Unnecessary Repetition Bureau) gets run and…
…wait…
…until it finally finishes. Then just for safety I do a cabal update again. Only to be told that there’s an update available to cabal-install.
This isn’t looking so good, is it?
I decide to ignore that error and continue with the advised installations. I cabal install cabal-dev and…
…wait…
…until it finally finishes. Then I cabal install yesod-platform and…
…wait… ...wait… ...wait… ...wait…
…until it finally finishes RECOMPILING THE ENTIRE FUCKING WORLD!
But, at least, it now worked. The installation succeeded and I can run the yesod command!
Oh bliss, bliss and heaven…
yesod init # answer the questions
cd yesod
cabal-dev install
Oops. Fucking major oops here. Because, get this, cabal-dev RECOMPILES THE ENTIRE FUCKING WORLD ALL OVER AGAIN. EVERY library I’ve ALREADY installed via cabal gets recompiled again. “Initiative comes to thems that waits” indeed! I had a whole lot of fucking initiative going on here, let me tell you!
Still, surely this was all worth the wait, right? I could finally, after the successful build, finally get my type-safe web-app building funk on, right?
Suddenly, I viddied what I had to do, and what I had wanted to do…
Not a fucking chance in Hell.
yesod --dev devel
And…
…wait…
…until it finishes building shit. (How many times have I had to compile shit now just to get a web app started?!) Mercifully this was a far shorter build. It only had to recompile 8 files this time. Unfortunately it crashed hard on the last one. Apparently cabal-dev does something weird with ghc, wrapping it in something else, and that was doing stuff that made it throw up its hands and just give up.
…and that was to do myself in; to snuff it
And that’s just what I chose to do. I threw up my hands and just gave up. The Haskell ecosystem is a worthless pile of shit, as far as I’m concerned. As someone put it in #yfl:
Haskell people don’t know when they’re shooting themselves in the foot because they can’t remember what it’s like to have a foot without a bullet wound.
My off-and-on experiences with the community over the past six or seven years bear this out. The intellectually inbred world of Haskell is such that people within it honestly can’t even see just how bad their ecosystem is. They’ve just internalized all these fugly quirks and failures and adopted what is to them minor little workarounds to each of them without once thinking of what it feels like to someone coming in from outside.
And keep in mind that Yesod is one of their points of pride; one of the things they point to as a success story for Haskell. (The other one they point to—xmonad—has very similar problems as soon as you start trying to use any kind of contributed modules.)
This, guys, is really not how to convince people that your platform rocks. Even if your platform is spelled E-R-L-A-N-G or R-A-I-L-S or N-O-D-E or…
A (thinly-)veiled parable of failure
Every once in a while, in the religious world of software, you get a schism. They happen everywhere you can imagine, no matter how stupid they may seem. It even gets down past the wars like vi vs. emacs and into emacs vs. xemacs or vi vs. vim or the like.
There’s a holy war and a schism happening in a language community I peripherally inhabit. Just to keep this as non-personal as I can get I’m going to be using pseudonyms for everybody except me. I’m even going to be using pseudonyms for the software technologies involved.
Dramatis personae
| Shen | an established software technology of fringe popularity |
| Panacea | a newer software technology based off of Shen |
| ttmrichter | your humble narrator and oft-time user of Shen, noted within the community mostly for incoherent ramblings on and vituperous hatred of the software development industry |
| livingbuddha | a(n in)famous user and fan of Shen |
| immer | another famous user and fan of Shen |
| gagarin | a famous former user of Shen who has converted to the new religion of Panacea |
An important afterthought based on feedback
The name Shen used in this story is not the Shen programming language. The selection of the name Shen was done in ignorance of the existence of the latter and I apologize if any were confused.
Software zealotry
There is something strange about software geeks that makes them form emotional attachment to their tools. Dispassionately viewed, the following facts are obvious to all… except the software geek:
- compilers are tools;
- programming languages are tools;
- editors are tools;
- debuggers are tools;
- libraries (even when they’re called “DSLs” or “frameworks”) are tools.
It really is that simple. Anybody who disagrees with the above is an idiot, pure and simple. (That means if you’re reading this and you disagree with the above, you’re an idiot, yes.)
Now imagine if, say, an automobile mechanic were to get so emotionally attached to his 9mm socket wrench that he won’t use anything else but that 9mm socket wrench. Is there a 10mm bolt that needs tightening? Well, he’ll grind down the head of it until it’s (approximately) 9mm because “everybody knows” that the 9mm socket wrench is the ONLY tool worth knowing, right?
We would, rightly, think any automobile mechanic who held these views was a lunatic, possibly a dangerous one. Yet most people who work in software act in exactly this way and, indeed, in worse ways. After all even if there were an automobile mechanic who fixated on his 9mm socket wrenches, there’s a very good probability that he wouldn’t go insane and start pounding the skulls of people who dared to use a 10mm socket wrench (not to mention those motherfuckers who sometimes use SCREWDRIVERS!). Software people do the equivalent, however all the fucking time.
The story so far
So, there is a schism brewing in the Shen community. Shen is old and crusty and, despite it being proven technology, many young bucks who use it chafe at its limitations and ugly corners and yearn to be free. And their cries did not go unheard for someone created for them the Panacea tool. Panacea is magical. It is “modern” and “productive” and is the cure to all of Shen‘s problems. Even better, it is built atop Shen so Shen‘s userbase can shift to Panacea without difficulty and without giving up all the wonderful things that made Shen the proven, strong technology it is. (You know, like how becoming a Mormon doesn’t mean you stop being Christian, right?)
Of course, as is usual when a new religion comes to town, there are zealous converts and the zealous convert of our story is named gagarin. Gagarin was once a pretty well-known figure in the Shen community, famous mostly for churning out a lot of work using Shen. (The fact that much of this product was half-assed, poorly thought-out, and/or incomplete is beside the point.) He, however, also constantly chafed at the restrictions Shen put on him; restrictions he believed suppressed his creativity and his productivity.
The elders of the Shen community, among them livingbuddha and immer, shushed him quietly and explained patiently why the things he lamented were good for him, not bad; why he should learn to love Shen for what it was and even to forgive its occasional quirks. This failed to satisfy gagarin, however. He looked outside the community for answers and found them in Panacea.
Cue that bit from the Rush song where the guy plays his guitar to the priests.
Yes we know it’s nothing new.
It’s just a waste of time.
...
Forget about your silly whim,
it doesn’t fit the plan.
Because much to gagarin’s shock and dismay, the Shen community reacted to his enthusiastic (verging on bombastic) proselytizing of his new faith with a collective yawn. People he’d thought of as his equals, (indeed at least one person he’d looked up to!) in the community were pooh-poohing his wondrous new tool.
I can’t believe you’re saying…these things just can’t be true!
Our world could use this beauty. Just think what we might do.
...
There’s something here that’s as strong as life.
I know that it will reach you.
Gagarin was flabbergasted! Maybe it was understandable that livingbuddha didn’t want to convert; he was practically a high priest of Shen, after all, but immer?! Why didn’t immer want to join him in the new faith?
Slàinte Mhath
Of course things did not go well from there. Gagarin, like most new converts in religion had no idea how to go about proselytizing intelligently. He spammed the Shen IRC channel with his Panacea code and discussions using the disingenuous excuse that because Panacea used Shen underneath it all, it was Shen and anybody who didn’t see that was just not looking closely enough. So… more Panacea spam was clearly the answer, right?
This, sadly (for gagarin, I mean) did not work. All he did was annoy his former coreligionists in Shen. Eventually people got sufficiently annoyed by his behaviour that they hounded him out of the Shen channel (while he ragequit the Shen community at large, it seems). Of course anybody who’s ever seen the reaction of a religious community to someone who converts out of it should not have been surprised in the slightest.
And the backbiting begins
Your humble narrator decided to peek into the Panacea community channel after this out of a sense of morbid curiosity. Sure enough the bitter gagarin was in there backbiting his former fellow travellers in the Way of Shen. Your humble narrator, for example, was merely “book smart”. (This is a peculiarly North American phenomenon where someone who bothers to educate himself is viewed with suspicion verging on derision. The fact that I’d been coding things people actually use since before gagarin was even born, naturally, fell by the wayside in his assessment.) My opinion having been safely dismissed as being based on knowledge (?!?!), he progressed to backbiting others in the community. Immer was very smart and able but too stubborn to see the Truth and the Light of Panacea. And, of course, livingbuddha was too much a fan of Shen (the implication being that he had an unnatural and perhaps even unhealthy attachment to it!) to ever be open-minded.
You know. Exactly the same kind of vicious and unhealthy backbiting you’ll hear from converts to, say, Islam talking about their unconverted family and friends.
So what the fuck is actually going on here?
I wish I had a decent conclusion to this story. I really do. But I don’t. Because I’ve seen this story play out so many times in so many ways with so many software technologies that I could have typed out this PRECISE sequence of events even had I not just experienced it (again!). It’s one of the reasons, in fact, that I decided to use pseudonyms for this story. There’s nothing particularly special about it. I’ve encountered dozens (maybe even hundreds!) of gagarins in the past and I expect to encounter dozens more before that brain tumour I’m hoping is there gets me to the point where I go on a massive shotgun rampage in a software company.
There is something fundamentally wrong in the head of software people; something that turns them into raging retards whenever they encounter an opinion that differs from their own; something that renders them utterly and completely incapable of just living and let live.
I don’t wish gagarin (in any incarnation!) any particular ill will (although I’m happy this particular one ragequit the Shen community channel given his proclivity toward being an ass). I’m happy he’s found something he likes and enjoys. I’m just not so happy that he feels the need to either convert everybody to his new religion or to pour derision on them when he thinks their backs are turned just because they disagree with something he likes.
If you’re reading this and you think you might be (one of) the gagarin(s) I’ve mentioned? You probably are. Stop being a cunt. If you’re reading this and you’re thinking of going the route the gagarins have taken? Stop being a cunt. Just be happy you’ve found a new tool.
And here’s the big secret, fellas (because the gagarins are always male!): having a new tool doesn’t mean you have to throw the old one away. It’s possible to have both a 9mm socket wrench in your toolbox and a 10mm one. And, if you’re brave enough, you can even have a hammer, a screwdriver or two and even a tape measure!

The ontology of the lambs
There is a lot of buzz being generated on Twitter right now as a result of some ignoramuses, led by the inimitable Zed Shaw, taking to launching multiple-tweet angry tirades (filled to the brim with as much profanity as 140 characters will permit) against advocates of strong static typing in programming languages. In addition to the profane personal attacks, there is a strong tendency to use straw man fallacies to the point that you’d be forgiven if you’d thought you’d wound up somewhere in Bizarro Earth where up is down, black is white and the Republican Party is the bedrock of tolerance and diversity.
What is astonishing to me about all this is the raw anger these people demonstrate. The raw hatred they spew for those who favour and use strongly and statically typed languages. Or, rather, it would astonish me if I didn’t already know the why. For the rage of Zed (and others like him) is the “rage of Caliban, seeing his own face in a glass”.
The ontology itself
Now keep in mind here that I do not mean the following three terms in their literal meaning. I’m invoking Forms of sorts, albeit fairly vaguely-defined and ephemeral ones. I’m using the three terms, in short, for a form of symbolic meaning, not literal truth.
The terms are:
- Technician
- Engineer
- Scientist
These three forms will be capitalized to distinguish them from their prosaic, better-defined real-world terms. I submit, however, in brief, that programmers fall into one of these three Forms (predominantly, I mean, there is overlap) and that accepting and working within these Forms will improve the world of software in measurable and important ways.
The Technician
In one of my earliest jobs in tech, I worked for a (very) small hardware manufacturing firm. How small was it? In the firm proper there were three people: the owner/boss, a technician and me as the software dogsbody. The technician was a nice, gentle Polish guy who was very good with his hands. His job was to populate our trial boards with components (assembly, in a word), to diagnose flaws and errors in the boards, and to, within limits, perform repairs on the prototypes to get them into functioning order for the next revision of the actual PCB.
At no point did this nice man, however, ever do anything creative. He was remarkably well-trained in his field, had a broad knowledge base, but he had no actual education. It was all training; a sophisticated intellectual toolbox and a sophisticated set of tools to use, but in the end still pre-formatted, pre-arranged, work using pre-formatted, pre-arranged components and tools.
In any engineering discipline, you’ll find technicians outnumbering engineers by anywhere from 2:1 to 10:1 and beyond. I submit that this is the same in software, but that we haven’t (yet) reached the stage of actually distinguishing between Technicians and Engineers in any formal fashion.
(And nor have I yet actually talked about what I mean by Engineers. I’ll correct that now.)
The Engineer
Again, going back to that job, my boss in this tiny firm was an engineer. He didn’t (often) assemble or repair things. He designed them. He saw a capability need of some form, figured out how to meet that need, designed the boards for it, selected the required components to go into them, etc. He created in short, building things that had not yet been built before. He may have used predefined concepts and components, and he may have rigidly applied some well-known conventions in the process, but in the end he created new things. His skills, knowledge and education were a step above our technician’s in that he solved problems using new, as yet uncreated technology.
Now before the straw goes flying fast and hard, please note that I’m not saying that this engineer was in some way a better person than the technician. I’m not even saying that he was more valuable to the company! The fact is that our technician was probably the most valuable to the company in the short term because his hard, boring drudge work was what allowed the boss to get on with his own work and gave him the time needed to create things. If my boss had to do all the assembly, debugging and repair work himself we’d never have made it to market.
Again, as in this electronics field, I submit that there is a distinction between the Technicians of coding and the Engineers of software development. I also submit that, depending on context, as with my former employer, both are actually necessary. The Engineer is not a better person than the Technician, nor is the Engineer necessarily more valuable to a company. It is, however, important to note that there is a difference and that this difference necessitates different handling of each’s working life, supervision, etc.
The Scientist
In the context of electronics, the technician, you recall, assembled the boards, and the engineer designed the boards. So what then is the role of the scientist? Well in this context the scientist is the person who invented the transistor (or whatever other ground-breaking piece of technology you choose to use—it’s not as if there’s a paucity of examples here!).
The Scientist’s main area is inquiring in nature. Where the Technician and the Engineer are concerned with making things that work, the Scientist is more concerned with pushing back the boundaries of human knowledge, even if it doesn’t necessarily have immediate practical benefits.
Again, as before, I submit that the realm of software has its Scientists. These are the people who invent the new techniques the Engineers use to design software systems and the Technicians use to implement them. They invent the algorithms, the “esoteric” languages, the paradigms and put them on a firm theoretical foundation to build up from. And again I submit that these people are not intrinsically better or more valuable. It’s just a different focus of interest and intent.
Examples
Examples of the Scientist Form in computing would be people like Knuth or Dijkstra or McCarthy for the big names. It would involve, too, the lesser-known names like Parr or Peyton-Jones or Bone or their ilk. All of these people have, to one degree or another, pushed back the boundaries of human knowledge and added tools, techniques and even simply thinking patterns to the field of software.
Examples of the Engineer Form in computing would be people like Ritchie or Moore. Ritchie, for example, together with Thompson and others of that team, created Unix. Unix was not groundbreaking in any of its features. Most of the “firsts” that are cited for it by its unthinking fans (and, thankfully, not by any of the principles involved) are not firsts. Unix was a product of taking the best known practices of the time and putting them together into a new and unique whole. This is the Engineer in a nutshell.
Moore, similarly, in inventing Forth, was not inventing anything new at a conceptual level. Stacks were known. Dictionaries were known. Modular programming was known. Even implicit operands or rapidly building abstractions upon earlier abstractions were all known techniques. (APL, for example, predated Forth by about four years.) All the techniques were old hat (relatively speaking), but Moore put them together and created something new with them.
By their very nature, Technicians are not going to be well-known, so it is hard to name examples. Instead I’ll point to the kinds of people who are the technicians in software. Think of the body shoppers in big consulting firms like Accenture/Andersen or EDS or their ilk. I’m not talking their “designers” or “architects” or that kind of person but rather their coding drones who are given a function/window/table/whatever specification who then type out the code that implements said function/window/table/whatever specification. This is the Technician of software development.
The problem
The problem is one of communication and identity. Explaining the communication problem is simple. For a Technician to be useful, they have to understand enough of the vocabulary (and thus thinking) of the Engineer to follow explanations and instructions; to discern intent from vague pronouncements and to build up their work from that. A Technician that can’t understand Engineers is useless and, likely, in the very near future, out of a job.
Similarly, for an Engineer to make new things, they have to understand what the Scientists are talking about sufficiently to turn the academics’ ideas into something practical and useful. An Engineer who can’t understand what a Scientist communicates cannot make new ideas into practical, useful or even beautiful things.
The problem, I think, is that people like Zed Shaw (and those who lionize his angry person/a) are at their core Technicians. They may be very good technicians. They may have a large tool belt with a lot of specialized tools. They may have a great deal of in-depth training. In the end, however, they’re Technicians. They assemble things based upon the specifications and instructions given by others. Just like the technician in the small hardware firm I worked for they may occasionally dabble in making things of their own (I did mention that the categories don’t have hard boundaries above, after all), but overall they remain Technicians: the assembly line workers of software.
The thing is that they don’t perceive themselves to be Technicians. They are emotionally invested in being Engineers and/or Scientists. And yet they cannot actually understand the output of software’s Scientists (this link alone should be ample evidence of this!) and this holds up a glass to their face that reflects something they don’t want to know: that they are not truly the Engineers they believe themselves to be. They rage at the looking glass because it doesn’t show them what they believe it should; they rage at it because it shows them what is, not what they desire to be.
The solution
For people like Shaw and company there is no solution. Reality faces one way, they face another. Their rage is real and exists because it strikes at the heart of their perceived identity.
But why is that their perceived identity and why are they so invested in it?
I think it’s because we, in software, don’t value our Technicians enough so nobody wants to be one. In that small hardware firm the technician was a highly valued member of the team; without his work there would have been no company at all. He was not looked down upon. He was not sneered at. He was not derided. In software, however, the Technician is given all sorts of epithets: code monkey, keyboard jockey, remote keyboard, technical stenographer. Their work is described as “a simple matter of typing” or even worse.
Even worse, I think in software by not recognizing these three Forms, we do egregious harm to the whole software development process. Because even on something as simple as supervision and assignment of work you should be treating your Technicians differently from your Engineers and your Scientists differently from both.
I’ve seen a company that almost got this right. They definitely recognized their Scientists at Entrust in that the cryptographers on staff, some of whom were heavy movers and shakers in the field, were treated with the deference and the care you should be treating those whose job is primarily thinking and expanding human knowledge. Sadly it all fell apart with the Engineers and Technicians. There were people who were obviously Technicians (the clue lay in their proclivity toward cut-and-paste programming and the utter disasters that were their unfactorable, unmaintainable, unalterable code) given roles of Engineers while obvious Engineers were treated like they were Technicians who needed close personal supervision of detailed, closely-specified drudge work.
It doesn’t help that educational institutions blur the lines too. You can get degrees in “Computer Science” that show no hint of academic rigour at all. (When you graduate from a “Computer Science” program without exposure to at least five entirely different ways of thinking about problems, including at least one purely abstract way, you’re not a Scientist!) Indeed some trade colleges give better theoretical grounding than some universities. There has to be better stratification of education so that those suited by temperament or preference to Technician-grade work go to trade colleges, those suited to thinking of new ways to piece things together to solve problems can go to engineering schools and those suited to pushing back the foundations of abstract thought enter computer science programs.
But just recognizing the differences (and acting accordingly) is a good start.
Evil Spock
I’ve always had a bit of a fetish for evil code. Note that evil code is not the same as obfuscated code. Evil code is perfectly readable… syntactically. It just fucks with expected semantics when put to actual use. This Haskell snippet is a very simplistic example of what I’m talking about:
-- The types are right: why won't this work?
double :: Integer -> Integer
double = (*) 3
Syntactically there is nothing wrong with this code (provided you know Haskell’s syntax). It’s the semantics of a function called double that triples instead that are evil. In this case the evil is very mild because it’s very obvious. You would (rightly) get smacked for this if you showed it to a Haskell fan and be told to grow up. (You’d also probably be compared to Zed Shaw for not understanding that nobody whose opinion matters has ever claimed that static typing solves all bugs.)
More subtle evil can be found in the Mercury language’s documentation:
:- mode var(in).
:- mode var(free>>free).
var(_::in) :- fail.
var(_::free>>free) :- true.
This code shatters the purity guarantees of Mercury’s strong static type and mode systems. And just as with the Haskell example above the code is easily readable if you know the syntax of the language, but boy howdy would this suck trying to understand in actual code!
The point of the post
Which leads us to the point of my post. As I said, I quite enjoy reading and laughing at evil code. As a hobby, I mean. When in production code I go get the fire axe and start sharpening it. Lately I’ve been looking for (and creating) evil code in Prolog, getting to the point of actually making a project for an evil module for SWI-Prolog (and, probably with minor tweaks later on, for YAP as well). If you were sufficiently demented, you could actually put this line of code into a Prolog module and use the evil predicates I dream up!:
:- use_module(library(evil)).
Bored of readable conditionals? I can help!
The first pair of evil predicates I take from Perl and Ruby (and probably other languages): tail-placed conditionals. They are simplicity itself to define. Let’s look at the tail-placed if statement first:
if(Term, Condition) :-
( call(Condition) -> call(Term) ).
It’s succinct. It’s clear. It’s straight to the point. This is economy mode evil at its finest. With this predicate you too can write code as insane as this:
write('I like evil!'), nl if 1 = 1.
This is the same as saying in proper Prolog the following:
( 1 = 1 -> write('I like evil!'), nl ).
It just doesn’t have that unnecessary crud like “readability” or “sanity”.
Of course you can ratchet up the insanity by using my version of unless:
unless(Term, Condition) :-
( \+ call(Condition) -> call(Term) ).
This allows you to write abominations like this instead:
write('I REALLY like evil!'), nl unless 1 = 2.
Compare this to the boring, comprehensible old version:
( 1 \= 2 -> write('I REALLY like evil!'), nl ).
A note for my Perl and Ruby-using readers
Yes. I’m calling Perl and Ruby a major source of evil.
Wanna program with metasyntax?
Sometimes evil code is perfectly valid semantically, but the way it’s implemented is a major WTF waiting to happen. A perfect example of this comes from the SWI-Prolog documentation (and is thus presumably the work of Jan Wielemaker). The code is perfectly straightforward, although you’d better know your Prolog syntax very well:
... --> []|[_],... .
This little line of code is a spiffy little DCG rule that matches, well, anything. For some reason the author of it saw fit to use | for ;, but otherwise this is perfectly normal Prolog code. Well, except for the predicate name, I guess. Still, let’s look at it in use before we decide:
file_contains(File, Pattern) :-
phrase_from_file((..., Pattern, ...), File).
OK, I’m beginning to see the problem. Can you? Here’s a hint: it’s pretty traditional to use the … sequence in comments where the … represents material left out so the reader can focus on the parts that matter. (It’s also used as syntax in some languages like Lua for variadic parameter lists, but that’s not quite as egregious as this use.)
So why is this a problem? Isn’t it cool that … is being used as an executable way to say the same thing?! Well, yeah. It’s really cool! And it’s evil! Because we’re pretty much conditioned to view that kind of stuff as comment-space fodder, not as code. This is going to cause more than one double- or triple-take. It’s going to add cognitive load every time it’s encountered as we figure out whether this is executable WTF code or comment. So why not just code it like this?
any --> [].
any --> [_], any.
Ignoring the fact that the formatting is simply more readable, the use of it is also more readable:
file_contains(File, Pattern) :-
phrase_from_file((any, Pattern, any), File).
There’s no double-take here. It’s clear we’re matching a rule name any, then a pattern passed in as a variable, then that same any rule again. It takes no more typing, but it takes a lot less brain power when reading because we’re not struggling against years of conditioning.
No, really, the point
The point is that I enjoy reading and writing evil code as a hobby. When I saw that … predicate the first time (and figured out what it was supposed to do) I laughed out loud. It was a delightful find. And when I wrote the if and unless predicates I was chortling with glee at the fact I’d just turned a clean and consistent language into something Perl- or Ruby-like. (OK, well, not really. There’s no easy, readable way to match the sheer WTF of Ruby monkey-patching in Prolog, nor the whole magic come from thing that is the OOP version of polymorphism.) I’m still thinking of evil things to put into Prolog just for the joy of it.
But please, don’t use this kind of stuff in your real code. As an intellectual exercise, evil code is fun. Seeing that evil code in production isn’t fun. It’s a nightmare.
If you’re using a language that permits tail-placed conditionals, for the love of God don’t use them! Get over your “it’s too much typing!” fetish and use a proper, head-placed conditional, even if it’s the conditional operator (… ? ... : ...). And if your language supports a negated conditional (like a head-placed unless) don’t use it either. Negative logic is difficult to reason about and is the source of many subtle, frustrating bugs.
Play with evil code. Don’t use it for evil.
P.S.
Please send me evil code (not obfuscated code!) from any language. I love that stuff!
Zed Shaw won’t be able to read this code
Zed Shaw posted an epic tweet today that contained a link to this set of code snippets. From context it’s pretty clear that he views the first of the two definitions more readable because they’re “real words” instead of abstract symbols.
Of course some people disagreed. Of course Shaw went off on them with profanity and insults (there’s more than just that link… much more!) instead of rational discourse. This is Shaw we’re talking about after all.
Where I agree
Now at some level Shaw is right: in the main it is better to use real words for variable names because it makes the code read more clearly. In my own code I tend to use descriptive variables—when the description matters.
I don’t always do this, however because, often, when a function is sufficiently short and clear it is, in my opinion, more important to get more of it in front of my eyes than it is to explain the pieces. Additionally, sometimes what you’re writing is very abstract and there simply isn’t any set of names you can give that are going to be meaningful without being limiting at the same time.
Where I disagree
I’ll put up an example of some of my own code; code that Zed Shaw won’t be able to read:
:- func compare_impl(number_impl, number_impl) = dec.
compare_impl(number_impl(S1, Co1, E1, C1), number_impl(S2, Co2, E2, _)) =
( S1 = S2, Co1 = Co2, E1 = E2 -> zero(C1)
; S1 = negative, S2 = positive -> minus_one(C1)
; S1 = positive, S2 = negative -> plus_one(C1)
; S1 = negative, S2 = negative ->
( E1 > E2 -> minus_one(C1)
; E2 > E1 -> plus_one(C1)
; Co1 > Co2 -> minus_one(C1)
; plus_one(C1) )
; ( E1 > E2 -> plus_one(C1)
; E2 > E1 -> minus_one(C1)
; Co1 > Co2 -> plus_one(C1)
; minus_one(C1) ) ).
I’m sure that Shaw will have an aneurism if he ever sees this code. My God! Not a single fucking descriptive variable name in sight! There’s no way anybody could understand this, even if they know the syntax of the language! (The language is Mercury.)
And he’d be right. Even for people who know the language you can’t figure out everything that’s going on there. There’s two important declarations missing:
:- type number_impl
---> number_impl(sign, integer, int, context).
:- type sign
---> positive
; negative.
(Let’s handwave over the context thing for now because that’s way out of scope here and doesn’t impact the calculation in any way.)
There. Now anybody who actually knows Mercury syntax should have no difficulty reading the code.
Now if I were following Zed Shaw’s school of thought, I would write the code to look more like this (I’ll put the type declarations where they belong this time):
:- type number_implementation
---> number_implementation(sign, integer, int, context).
:- type sign
---> positive
; negative.
:- func compare_implementation(number_implementation, number_implementation) = decimal.
compare_implementation(number_implementation(Sign1, Coefficient1, Exponent1, Context1),
number_implementation(Sign2, Coefficient2, Exponent2, _Context2)) =
( Sign1 = Sign2,
Coefficient1 = Coefficient2,
Exponent1 = Exponent2, -> zero(Context1)
; Sign1 = negative, Sign2 = positive -> minus_one(Context1)
; Sign1 = positive, Sign2 = negative -> plus_one(Context1)
; Sign1 = negative, Sign2 = negative ->
( Exponent1 > Exponent2 -> minus_one(Context1)
; Exponent2 > Exponent1 -> plus_one(Context1)
; Coefficient1 > Coefficient2 -> minus_one(Context1)
; plus_one(Context1) )
; ( Exponent1 > Exponent2 -> plus_one(Context1)
; Exponent2 > Exponent1 -> minus_one(Context1)
; Coefficient1 > Coefficient2 -> plus_one(Context1)
; minus_one(Context1) ) ).
Now I’ve tried my best to format this in as readable a fashion as possible and yet, to my eyes, it’s far less readable than my original form. Consider the first conditional clause, for example. In the first case the equality of the three variables is in-line with the result zero(C1). In the second case the relationship is muted and obfuscated. The whole thing now is a wall of text (that goes too far to the right) with words that are “descriptive” (and thus more “readable”) only if you don’t know the data type being manipulated.
And frankly, if you’re working on code without a complete grasp of the data types involved, get the fuck off of my code base!
Cargo cult programming
Programming is this bizarre field that probably has more cargo cult behaviour than any other I’ve encountered. (This even includes education which jumps from fad to fad with monotonous regularity, just not with the alacrity of software.) In this case the cargo cult is the one that says “long, descriptive names are always better than short, terse names” (note the stress there, it’s important!).
I’m not arguing that all code should use terse, “cryptic” names. I’m just arguing that terse names are in many cases less obfuscatory than long ones.
I submit pretty much the entirety of the Java ecosphere as my evidence.
Closing words from Gert M.
“Who’s Zed?” “Zed’s wrong, baby. Zed’s wrong.”
Would you people just stop?!
I’ve said this before, and I’ll probably say it again (and again (and again (and again (and again (and again (...)))))), but Jesus, people stop believing the god-damned press!
So what’s triggered my ire this time?
The so-called “facekini”
This retarded “news” story has been sweeping the net and swamping social media. The story is retarded and anybody who propagates it is retarded as well. (Yes. If you passed on that story without sceptical commentary of any kind you are a fucking retard too!) Here’s an example of the typical reportage surrounding this:
(From the NPR blog)
The headline
“On Chinese Beaches, The Face-Kini Is In Fashion” the headline blares. The obvious inference you’re left to take is that this is a craze that’s sweeping China. Immediately under this “herp derp them furners is funny!” headline you get this picture to hammer it home:

This is no accident. NPR, like all journalists, knows that about half the readership will read only the headline and, if there’s a picture underneath it, will look at the picture and that’s it. The intent of these “journalists” is to make their readership feel good about not being the people reported on; about being, in this case, Americans who are “normal” and not them funny-lookin’ furrners.
But…
Let’s start actually reading
Cynical old me notes that this picture is tightly cropped to only show two people. My “press bullshit alert” alarm starts blaring and I start paying more attention. I then note this paragraph:
In China, it’s the height of the tourist season for Qingdao’s famed beaches. But while many of the town’s visitors want to enjoy the sand and water, they’re not so wild about sunbathing. So they often resort to a local tradition: the face-kini, a sort of light cloth version of a ski mask.
Oops. My cynicism is already showing grounds, isn’t it? It’s not “Chinese beaches” but only Qingdao’s beaches. Further this isn’t, as the headline implies, a craze sweeping the Chinese nation, it’s one fucking city.
Still, there must be more to this story. As you read on, the writer of the herp derp piece goes on to deftly misdirect you from the sole factual paragraph of the piece into hinting again that this is a nationwide trend. The fact that it’s a local tradition is given very short shrift while the “terror of tanning” is spread all across China and even as far as Korea, again implying that this trend is nation-wide and has even reached as far as Korea.
And yet, as far as I can tell from this article, even the fact that it’s fashionable in Qingdao is questionable. Let’s look at the only other picture this article provides:

WTF?! Again we have a picture tightly cropped to show only two people. And again my bullshit alert is blaring loudly. Someone is being an asshole and, for a change, it seems it’s not only me.
Huffington Post is fair and balanced?
Yeah, I know, that scares me too, but really the Huffington Post is being fairer and more balanced than NPR. Note the difference in the headline for starters: “Face-kini, Face Mask Bathing Suit, Is Popular On Chinese Beach”.
Now it’s a Chinese beach, singular, instead of Chinese beaches, plural. That alone makes me scared: the Huffington Post, people, is being less sensationalist and more intelligent than NPR. But let’s read the article a bit more.
…the latest swimwear innovation in the Chinese resort town of Qingdao…
Oops. They’re not reporting it as a “local tradition” either, but rather a new thing. On the whole the Huffington Post article is far less sensationalized than the NPR one (I know, I know!) and, as a result, is far more accurate. They’re not making global proclamations about how the Chinese hate dark skin (”...many Chinese women who prefer a fair-skinned complexion…”). They’re not trying to imply that this involves Korea in some ill-defined way. They’re straight up reporting some facts.
Photographic evidence
The clincher, however, is in the pictures. Let’s look at a few examples from the slide show beneath:




Are you seeing what I’m seeing? How the fuck would you know?! You can’t read my mind!
I’ll tell you what I’m seeing, though, so you can see it too. I’m seeing pictures where anywhere from one to three people are portrayed wearing these face-kinis (and attendant full body suits) while in the background dozens of people are being seen who are very clearly not wearing them. Far from being the nationwide craze that’s sweeping China’s (and even Korea’s!) beaches that the NPR hack job was trying to report on, it’s pretty clear that this is a) very localized and b) not even very popular in that locale.
Don’t trust the press
Really, it’s that simple. Don’t trust the mass press. For anything. Ever. I can even prove to your satisfaction that you shouldn’t do this.
Here’s why
Take a subject you know; that you’re somewhat of an expert in. You don’t even have to be grandmaster world champion levels of expert here. Just semi-competent at it is enough. (Good news, software people! Semi-competent includes you!) For example, I could use computing as my subject, or Chinese culture, or history or even scientific fields like physics if I stretch a little.
Now take ten random newspapers and search for articles related to your area(s) of expertise. Read them. Count the egregious errors of fact. Count the over-simplifications. Count the hand-waving. Count the instances of false controversy. (What do I mean by that last one? “ONE BILLION SCIENTISTS SAY X, BUT PROFESSOR Z SAYS Y SO WE’RE GOING TO GIVE HIM EQUAL TIME FOR PURPOSES OF ‘BALANCE’!”)
Given how badly the press reports on areas you know, what makes you think they’re any better in areas you don’t know?!
Wake up, please. And, if you’re one of the people spreading these “herp derp them furrners sure is funnay!” stories (of any country at any time) please stop and start using your fucking head for a change.
Esoteric languages
In the Fantom Programming Language forums there’s a thread on building a business on an esoteric language. The opening message is the kind of “thinking” (for want of a better term) that just drives me nuts.
“Hi all, this might not be like the normal discussions around here. I myself thought of Fantom as a beautiful language, yet wouldn’t building a business on top of an “obscure” language like this would be pretty hard and disadvantageous? Mostly when hiring programmers?”
I posted an answer in the thread, but I thought I’d post (largely) the same answer here:
- C
- C++
- Java
- C#
- PHP
- Python
- Ruby
- Erlang
- Lisp
- Prolog
- Forth
Each language I’ve named above has at one point or another (some of them right now) been accused of being an “esoteric” programming language. Each of these languages has had (wannabe) pundits claiming that basing a business off of them would be a Bad Idea™ for Good Reasons™ including, but not limited to:
- Difficult to hire programmers.
- Difficult to get support.
- What happens if the vendor/creator/whatever stops working on the language?
- No surrounding ecosystem to filch code from.
Yet each language I’ve named above has multi-million to multi-billion dollar businesses based upon them.
The conclusion is simple: never base your business decisions upon the yammering of wannabe pundits. Analyze your needs, your resources and the capabilities of your possible tools. Sometimes this does, in fact, mean you won’t be using an “esoteric” programming language, but more often than not, if you do a decent analysis, you might find your “esoteric” programming language is a competitive edge.