‘Iacta alea est’

The Sands of JavaScript

Penned on 25th January 2016

When everyone was writing assembly language no one thought that they would one day be programming at a higher level. If they did think so, it certainly wasn’t going to be any time soon. There is a certain myopia that comes with the regularity of the quotidienne—it is hard to imagine tomorrow being different. Next month, year, maybe; but not tomorrow. The danger of stringing together a sequence of unchainging tomorrows is that those days turn into weeks, weeks turn into months, months turn into years and before you know it you’ve been left behind as a new wave of progress leaves you gazing enviously at the Jones’ next door, wondering how on earth they managed to acquire the gadgets that leave your perfectly workable but unquestionablly dated methods in the dust. The danger is that in the face of the heavily marketed 2× or 3× improvements on our current tooling we may well miss the true game-changer by burying our head in the sand. I believe that sand is JavaScript.

Even if we aren’t truly submerged, the act of piling on every recent ‘innovation’ or ‘paradigm shift’ places us in a sandstorm that clouds our vision just as much as if we were. It might even be worse because with our head erect, we deceive ourselves into thinking that we are alert and attentive to what is going on but we are just as blind. It’s still all sand.

Sand is useful, but sand is a substrate. You don’t build a house on sand, or maybe you do, but then the rains come down and the floods come up and you know what happens next. You add piles when building on sand, seeking a firmer footing and foundation beneath it.

Sand is useful but sand is an aggregate. You don’t build a house with sand, or maybe you do, but then the rain comes down and the floods come up and you know what happens next. You mix the sand with other aggregates to form a composite. You can use that composite to make bricks, fired in the kiln; to make the cement that binds bricks together, to make concrete that sits on top of the piles as a foundation for the (super) structure you want to build.

Sand is useful but not when used alone. It’s a lot of fun, O yes, but it’s fun for an afternoon; when the tide returns you devise all sorts of water diversion tactics to avoid the inevitable collapse that using sand entails. The joy endures for a night, but sorrow comes in the morning.

We have not yet acquired the self-awareness—or the humility—to admit that we are still playing in the sand. We have devised ingenious methods of managing it and getting the best out of it, but we are still using sand. We have prefabricated floors in our buildings but when we want to wire it all up and do the plumbing, the sand reveals itself to us; we need experts in that particular brand of pre-fab integration technology who tell us we shouldn’t have put together their sand in the way we did and pull some glimmering sand from their pocket to sprinkle over the join and make it all better again.

We have plastic shapes and moulds into which we can pour our sand to give it a particular type, but when we remove them our sand is free to assume any form it wishes, our best intentions crumbling with it. Sand is so granular that it crumbles easily, but it also encourages us to just add another bit of sand everywhere, even in places it shouldn’t go. Let’s pepper over HTML, or spice up our CSS, a little sand can’t hurt, but it becomes less and less distinguishable from mud in some places.

Mud. Big balls of mud. That is sand mixed with whatever we fancied on any given day. Coffee one day, tea the next. The new herbal remedy that cures all sand-related ailments… for that week. Sand gets everywhere, is amorpohous, its grains indistinguishable, managing it and the monster you made with it futile.

Adding new features, even the smallest, precipitates the sandy avalanche on your unstable pyramid. Straws breaking camel’s backs. Breaking your back. Breaking your resolve. Sandcastles were so much more fun when they were just for fun. It all got a bit serious. Too serious for using sand anymore.

There will naturally be those who purposefully stride onto the building site with a suit and an ill-fitting hard hat proclaiming that you’re not using the sand in the right way and if only the workers could do it this way then it would all be fine. Not everyone in construction has an architecture or engineering degree. And those who do didn’t all study at the same college. Functional State was a very different proposition to the Object Program in the Orient. And that didn’t always fit with the declaration of one college who deemed their program imperative.

All those grains can be put together in so many different ways, and there are more opinions than there are grains. We cannot ignore the sand, but I believe we can do two things. We can drive piles into the ground using sand as our substrate—this is the piles reaching the firm foundation of functional programming while allowing us to retain the access to the important surface that brosers provide—and we can use sand as our aggregate—using JavaScript as the part of our bricks that allow us to run on the JavaScript runtime but are made of much more solid and reliable material than what JavaScript alone could give us. This is a type system which provides a robustness which is the perfect antidote to the fragile and brittle nature of much of what we build.

We need something that is antifragile, something that in one form or another has existed since the dawn of the computing age, something that bears the influence of ACM Turing award winners while remaining accessible to everyman.

Elm promises that resilience and accessibility.

Friday 22nd January 2021.