I have started to play with Clojure recently. Considering my object-oriented programming background, this (unsurprisingly) made me think long and hard on many occasions.
One of the things that struck me was Clojure’s rich ecosystem of (often) small libraries that are expected to play nicely with each other. A common question on the web is “How do I get started with web development in Clojure?”. A common answer is “Ring + Compojure + Hiccup”. Don’t like the way one library does its job? Just use a different one!
Contrast this with, say, Java, where you typically pick a single web application framework that often has strong views on most aspects of a web application. Using a different approach, library or framework for just an aspect of the web application is often difficult if not impossible.
Note: This is not a Clojure-is-better-than-Java post. I don’t try to advocate a specific approach, criticise a specific framework or take swings at anyone. Peace!
A framework and a library’s functions are (or, better, can be) very different beasts. A framework often does what it says on the tin: it provides a frame (a mindset, a way of doing things, a safe, delimited space that you’re not supposed to venture out of) in which to work. When you start bumping against a framework’s boundaries, i.e. often that frame itself, you’re often out of luck: there is often no simple, let alone supported, way of moving beyond that boundary.
Working on e-commerce sites, I’m being told that it is difficult and costly to fully control the path component of URLs in a specific successful platform. I find that difficult to stomach: Why shouldn’t I be able to do this easily in 2014, when this was trivial in 2004?
Composable libraries, for better and worse, do not provide such a rigid frame: the greater flexibility, the higher degrees of freedom mean that the way ahead is often not mapped as clearly as when using a framework.
Looking at the positive effects at unbundling elsewhere (say the telecommunications industry as a large-scale example), I wonder whether unbundling the services of what we used to consider single frameworks, applications or platforms may be beneficial. For me, and others, I presume, monoliths have lost their appeal long ago. But then they might have been essential in getting here from there.