Clojure for the past 9 years and forseeable future
June 14, 2024Professionally it started with PHP where I was building out custom Wordpress blogs from Photoshop files. I then (re)made a very complicated online collectible virtual fantasy pet platform.
Upon completion of that, I didn't want anything to do with PHP ever again. I learned Rails and TDD to help me solve the problems I had with the complexity refactoring a PHP project.
I jumped into web development just solving other people's needs without any formal background of software engineering. At some point when working on a side project in Rails, I realized I was a 'framework' programmer who was adept at doing things that had documentation and stitching libraries together, and so were my colleagues. Doing anything that strayed far away from the guard rails of what was provided to me wasn't very easy.
Early on in my career I attended a small hackathon event in Dubai for web developers. I destroyed the first two rounds, being the first one done and went beyond and above
the requirements. Then they gave us some data in the form of csv and told us to visualize it. I froze up. This was unfamiliar territory, outside my ORM where
I could do $object.all.each
and iterate through it. I ended up spending the entire time allocated trying to hobble together a quick CSV to ORM library
so I could work with the data in a manner that ORMs taught me to. I completely failed in doing that and ended up achieving nothing for that final round. It completely humbled
my inflated ego from my first two wins.
At some point I read Paul Graham's Beating the Averages and felt I wanted to learn a LISP. Then around 2014, I read The Nature of Lisp and remember my mind exploding from the enlightenment and learning a LISP was my only way forward.
I had another realization. The essence of what I've been doing all these years is just data, transforming data, and threading data through APIs. That's what both backend and frontend web development is at its most boiled down substance. Anything that gets you closer to that essense is going to be a better experience in getting things done.
Clojure puts data and data transformations first, and all the things that were magical to me using Rails and the ruby ecosystem are plain to see in Clojure. Using an ORM for half my programming career at that point and CLI tools to generate controllers, models, and migrations was like being great at ordering fast food but not knowing how to put ingredients together and cook your own meal.
Object oriented programming just adds layers of nonsense to data. Instead of just taking information (a data structure) and acting on it (a function) you have to name everything, instantiate objects and twirl your in your chair reasoning, wondering, about the behavior of some object that has inherited 50 classes interspersed with public and private fields.
While it's pretty cool that you can call code like User.all
, coming from an uneducated background like I did meant that if there is no method on an object in some
library, I was in hard mode territory. I've seen this with myself and my fellow colleague working in Rails. The extreme convenience gave us initial speed but also made us incompetent and
slow when we inevitably were required to push webapps past the boundaries of out of the box solutions.
I cannot believe the amount of libraries in the Ruby ecosystem that exist just to call APIs of random SaaS products just to instantiate objects with just JSON data that are mapped to fields so a junior developer could use the dot operator.
A talk given by Tim Ewald explains the power of clojure by comparing it with woodworking. I've watched this twice, the second time when I started woodworking as a hobby. This talk completely matches my experience developing software. Just like in my early days, I was able to spit out models and pages at blazing speed using generators and libraries that did all the heavy lifting. But simply doing something with raw CSV data made my brain hurt.
Being proficient with molding data by hand makes you capable of making extremely bespoke things.
Since I've been using Clojure, I've transcended the limits of what I can achieve being contingent on whether or not a library or framework exists. This applies to any language, but Clojure's essence is strong data structures and core functions to manipulate them. You also have syntax irreducibility because it's a lisp and strong performance which allows me to run my web apps on cheap hardware. The ability to write code that compiles both on JVM and Javascript in the same file is superb for things like writing validation code once that works on both client side forms and backend.
This is why for at least business web applications, I will always default to Clojure when starting my own projects.