017 - on fish
on beautiful code
i learnt to program quite a while ago, back when i was a kid who wanted to make video games. back then, programming was a tool, one of the weird windows tucked away in the back panels of gamemaker 8 that i had to learn how to operate to make things work. i dont think i really liked it at all, my main emotions to it were frustration until i could finally get my code to sort of do what i wanted.
and then a few years later, i met one of the most passionate programming teachers i've known, and i met a community of people who used the computer for fun, and i learned an entirely new way to think about it. i felt pride for the code i'd wrote, i felt responsibility for the code i wrote, i learned how to write "good" code.
and then a few years later, i burned out of having a real programming job, and i started making games again, and i came to the conclusion that above all my job is to make things that work.
what does it mean for a program to be beautiful? ask me at any of these points and i would have given you a different answer. code is code, it can’t be beautiful. code is beautiful if it works. code is beautiful if it was written in a beautiful way. code is beautiful if it is principled. code is beautiful if it is elegant.
aside - on undeserved success
i, like i suspect many of my readers also did, grew up and live in a society. this has left me with various disorders, many of which i suspect i will be trying to overcome for the rest of my waking days.
maybe the most annoying of these is what i'll henceforth refer to in shorthand as my catholic guilt. in short, the inherent feeling that any good i experience must be earned with an appropriate amount of bad, and if i haven't had an appropriate amount of bad then i should feel guilty for any good. call it karma, call it catholic guilty, call it fairness, whatever, it sucks.
the habit is so easy to hold. get used to feeling guilty for one good thing, why not do it for the rest, too? it's so satisfying to keep loathing yourself.
all this to say that today i set about solving a quite annoying problem. the kind of thing that used systems in a sorta unusual way, to do something a bit odd, in a way that ideally would heal at least somewhat performance optimised. the kind of thing that takes a good deal of time and suffering.
and i got it working in an hour and sixty lines of code, because i had spent a good amount of time architecting the systems it was built on well, which i could bear the rewards of now, and i feel like shit about this. it feels cheap, like a fake, unearned victory, that's about to come crashing down around me as the illusion crumbles. my coworker was quite genuinely excited about me achieving this, excited for the new avenues it enabled, and all i can feel is the disconnect.
all in all, i'm glad it's a technical success, i guess.
on my father, the rationalist
for as long as i’ve known, my father has quite loudly considered himself to be a rationalist. the kind of rationalism in which you decide on a set of axioms, presumably at birth, and derive every decision you make in life from first principles from these. as with many things my parents believe i agreed with this for a good portion of my childhood life. as with many things my parents believe i now violently disagree with it.
one of my main ideas that i tried, fruitlessly, to argue, was that unless you assume an element of fatalism, the thing that separates us from any other natural force of this world is our ability to make mistakes in this way. it feels like a waste to me to try to act purely rationally, to try to use an machine blessed with the ability to make mistakes to simulate one that cannot.
on network protocols
when i was very little, i wanted to spend my life making physical things. i saw the world around me made out of steel and concrete and electricity and i saw a bit of magic in it all, and i desperately wanted to be part of it.
and then i saw a bit more of the world, and i learned about flaws in metal, and i learned how much of this world is held together by tape and string, and i learned about rust, and i felt like i'd been betrayed.
getting into the digital world felt like a return to this magic for me. code is testable. code doesn't rot. code can be perfect.
ha ha ha
when i was a teenager, i got really interested in how the internet works on a lower level, and i more or less had the skills to investigate, so i did. i spent my time in wireshark, in hand written tools i made reading the http rfc, and it very nearly broke me. believe me when i say that the internet is absolutely no better than any crumbling building. protocols haphazardly built on top of protocols on top of protocols, historical accidents that are now enshrined in a billion devices, the net of cheap fixes and hacks that are just barely holding everything together.
and the more i learned about computers the more i felt this. computers and the internet are so dizzyingly huge, so full of hacks, so full of direct mistakes, it is a genuine miracle to me that things function as smoothly as they do.
but it was in this that i began to see a different side of engineering. in the big pieces of architecture, in their elegance, but also in the terrible hacks, the awful bits of code written just to keep something running another few days. especially in these hacks.
it's all so human, isn't it?
the system doesn't generate these on its own. each of these is a person, a day at work, someone's desire to make the world a little bit better. each line of code is written by a person. sometimes you read a line of code and you realise you've written the same line yourself, before, and you understand so clearly what they were feeling when they wrote it.
on beautiful code
the rust programming language has an interesting operator used for template selection, ::<>
, the details of which i will not go into on this blog.
it was named in 2015 by the rust developer anna harren, who gave it the name the turbofish, which has since stuck.
the bastion of the turbofish is a test file in the rust compiler. it contains four lines of code, demonstrating the necessity of the turbofish operator, and thirty six lines of comment, as a memorial to anna.