Code & Magic
1997, 11pm. I'm one bottle of red wine down and I'm sitting alone downstairs in the family dining room using "internet". I've posted my first message board post ever and I'm having a moment...
In the early 1990s I got really into a band called Corduroy1 .
In the mid 1990’s I was in a band myself. We had a record deal2 but we didn’t have a website. Neither did we have £3500 to pay the local web design company to make us one. So me being me I decided to figure it out and make a website. Despite the record deal and certainly notwithstanding the attitude, I was not a rock star. To make ends meet, I worked an office job in Newcastle and I worked until 9pm. I’d get home to my parents house about 10pm and normally they’d be asleep. We’d not long had a “desktop computer”3 installed downstairs in the dining room. It was a beige box of mystery to me. However this beige box had mysteries I had to unlock so I often just sat downstairs “in the dark, on the computer”.
Being online in the mid nineties (before freeserve) cost money and worse of all it tied up the phone line. I paid Compuserve £12 a month for membership for the pleasure of being able to connect, 10p every time I connected and 3.5p per minute of use. I also had to pay for the time the phone line was connected at a rate of 3.2p per minute. I remember that because prior to the office job I had at the time, I worked at both BT and Telewest as a customer service / sales drone. This is a long winded way of saying that when I went online, I had purpose. You didn’t “browse” for fun because it got expensive fast. Office jobs paying £4.40 per hour for 16 hours a week didn’t quite cover everything I needed to buy. Let’s just say I had very understanding parents.
Computers are Magic
Ok, 1997. 11pm and the first bottle of wine was dead and the second bottle of red wine has been opened4. I’m doing research on other band websites. I’d been listening to Corduroy on the way back from work and I wondered if they have a website. Not many bands did, hence my desire for us to have one. Not only did Corduroy have a website but they had a killer one with a “message board”. I had no idea what a message board was, but there were loads of comments left by fans. My first thought was “wow”, they’ve got people updating their website every day - neat. I noticed the text box and I typed in some drunken drivel and pressed the button.
To my utter amazement - and I genuinely mean that - actual amazement - my message was there instantly. I went to be that night honestly under the opinion that someone on the other side of that website was a really fast typer and had taken my message, typed it very quickly into the code for the website and somehow updated the website before the page had reloaded on my side.
When I woke up (with a hang over because I did finish that second bottle) I decided it must have been magic. No human could be that fast. This was the magical seed from which germinated my entire technology career. A real Quercus silicus acorn.
Computer Languages are Magic
Fast forward a year and I’d built the bands website. The code was good old table based HTML. Some websites had a contact form and whilst I could build the form, I couldn’t figure out how to get it to send an email from a website. I could do the mailto thing, but that wasn’t what I wanted. I wanted to receive an email by pressing a button on a website.
In making the website I’d discovered that computers and the internet we’re not magic at all. There were rules and they had to be followed - but the end result was magical. However, having an email be sent by pressing a button on a webpage - that remained most definitely magic. I had to know how to do it so I started digging. It wasn’t long before I found “Matts Script Archive” and specifically FormMail. Upon discovering a download of the “magical software” I became giddy. I downloaded it and I opened it. I was expecting to see binary but to my absolute amazement I found plain english.
To say I was confused was an understatement. It was this moment, the second magic moment at a computer that I became hooked. I had to know more and I had to do it. That Quercus silicus5 acorn that had been germinated previously had now officially become a sapling.
Not long after that I bought a copy of the Perl Cookbook and I started learning. I read that book on the 30 minute train ride to work there and back every day. I’d love to say I became a perl wizard, but I didn’t. I got the email thing to work, but Perl was my first language and it was all a bit overwhelming. Syntax, package managers, text editors, debugging (not debugging with a D, but smashing head off wall until it works or you give up), operating systems, unix, linux, stuff, more stuff, 3.5p per minute, phone line engaged etc etc. I’m painting this out to be painful which it kind of was, but it was also exhilarating. I was learning at a speed faster than I ever remember learning at. As soon as I learned one thing, the next thing popped up.
The point being, as soon as I got an understanding of how to make something work then that thing ceased being magic. It became magical which was cool and all, but it wasn’t magic. It was a non-stop donkey and carrot situation.
I learned that magic is when you don’t understand a thing and it impresses you and intrigues you enough to convince you to explore it. That’s magic.
Software is Magic
Software is fits the definition of magic perfectly, specifically spells. Even MIT’s legendary Structure and Interpretation of Computer Programs (SICP) doesn’t hide from this association. After all, you write code and then you summon it. Your spells change the world, they manipulate it to your will.
Finding the magic is what keeps me learning. It’s a constant call and invitation to play, explore and become frustrated whilst you manipulate and reprogram yourself to work with the spells and incantations.
My weird pathway through life owes a lot to those late nights in the lates nineties chasing the magic. Drummer, web designer, web developer, businesses, startups and even the little sojourn into arboriculture. You always need to be chasing the magic.
Magic Elixir
I’ll wrap the post up with something that recently became magical after being magic. I’d had a long break from writing Elixir until March of this year. About six years to be precise and it’s amazing how quickly things come back. Often they come back stronger and that’s 100% true of my appreciation of Elixir. There’s a few things going on in the below function that I’m mildly obsessed with right now and they’re kind of connected.
The above function isn’t a terribly interesting function in itself, it basically determines if something should be delivered or collected in store. The attrs map that is passed to the function is the result of an API call to a Shopify endpoint. If it is a collect in store order, there’s no delivery data in the payload and if it’s a delivery order then there there is delivery data - simples.
The interesting things in this code are that there’s zero logic inside the functions and there’s minimal processing - just one update to a map. But the cool things, the magical things, are that there’s two functions with the same name, and pattern matching decides which function is called. In the first function we’re pattern matching on the API data, and this function is used if delivery is present in the payload. I’m pairing that up with some guards to make double sure we have the bare requirements to make something deliverable. It is a thing that decides what should be done, but doesn’t actually decide anything. Magical.
Right now I’m so excited by re-learning all of this that I’m waking up and cracking straight on at my desk with it. The Quercus silica is now most definitely an early mature tree. The magic has moved deeper down. It’s the Erlang Runtime System and the Beam. So guess where I’m going…
Chase the magic - nearly thirty years have passed since I was amazed at a message board and the fact that “code” contained plain english. I wonder what I’ll write about in another thirty? The first time AI made me laugh?
Thanks for reading. I appreciate your attention.
Cheers.
Jamie.
Corduroy - Dad Man Cat. Yes, I remain fully into them. Sexual filth is how I’d describe their that first album.
Pentium 2, windows 98, 128mb ram.
This is why I have not drank alcohol since 2008. I like it way too much.
There is no Quercus silicus. It’s a made up species of the Quercus genera