by michaelteter · 2y ago · 0 comments
I love Clojure as a language, and I have wanted to use it in production; but there are so few opportunities other than solo building - where you really have to climb a steep wall due to the Clojurist mentality of /Frameworks Bad! Choose all your own libraries good!/. Instead I have found myself happy and productive in the Elixir/BEAM world, of course initially because of Phoenix.
And like many people, I have just been accepting the destructive, non-historic approach to data management with typical RDBMSs. If there were a Datomic for Elixir, I'd probably use it.
Must Datomic (or a data management approach like it) be tightly coupled with Clojure?
I presented on Datomic at KotlinConf too, with some live coding starting around the 31 minute mark https://www.youtube.com/watch?v=hicQvxdKvnc
You probably need to be on the JVM, as the peer library (i.e. the "good one", where you embed the full query engine and data fetching directly into your business logic) is so far only implemented for the JVM.
I suppose 10+ years of weird license models and a hefty price tag haven't helped. Datomic turned free (but still proprietary) in 2023 though. But why Datomic isn't more widely adopted is a huge mystery to me...
I've been hearing about Datomic on and off over the years, and I never saw a clear answer to the simple question: what is it? What does it do?
Instead I saw it most often mentioned as an example of a successful Clojure project, and now that's how I think of it. Seems like poor marketing/branding if there ever was intentional attempt at it.
I'm guessing most people, like me, first heard about both Clojure and Datomic from one of Hickey's famous talks about software development. Coming from one of those, I guess it's a bit easier to understand what the various concepts and words mean from Datomic's website for example.
I guess the easiest way to put it: Datomic is a append-only (deletions via "retraction" records) database that lets you query through time (also called "Bitemporal modeling" with fancier words).
The features/benefits page I think is pretty clear (https://www.datomic.com/benefits.html) but again, might just be my familiarity speaking.
Datomic is actually only 'uni-temporal', it provides a database-wide, immutable "system time" (aka "transaction time") versioning + very effective as-of querying. This naturally falls out of the "Epochal Time Model" (see Deconstructing the Database, 2012). However there is no particular built-in support for any further mutable time dimension, see: https://vvvvalvalval.github.io/posts/2017-07-08-Datomic-this...
System-time is still very powerful though. The way I think of the difference is: system-time versioning is mainly useful for debugging and auditing (and of course for the horizontal read scaling), whereas valid-time versioning is useful for timestamp-based reporting (or other forms of in-application time-travel and modelling 'truth' in business data) where the system-time timestamps are not the timestamps end users are directly interested in, see: https://tidyfirst.substack.com/p/eventual-business-consisten...
At this point I’m pretty addicted to BEAM and the Elixir ecosystem though. (And LiveView!).
In addition to the cost and proprietary nature, I'd say there are two reasons;
1) New and different things come with risk, and many folks are risk averse, especially in groups
2) More concretely, it is very easy to write slow queries in Datomic, and it can be a struggle to diagnose why the order of your datalog statements matters so much
XTDB may possibly of interest in that case - there's been some recent chatter about adding support for Ecto via Postgres compatibility: https://discuss.xtdb.com/t/elixir-ecto-thread-from-slack/490
(I work on XTDB)
Try selling that to management as the place where you want to keep their data.
The XTDB team has pivoted towards a SQL-first approach (though still supports datalog) and now 'only' has the 'But why not just use Postgres' problem to solve.
Having personally moved from trying to use Postgres for everything (including lots of timeseries data with Timescale) to a dedicated and relatively unknown DB built purely for the purpose I want it for (QuestDB), I am all for more people trying to build databases that do specific things better than Postgres. However, it will be very difficult to create something that does literally everything Postgres can do but better, which probably makes Postgres the sensible choice for the majority of applications.
Not sure on your definition of 'people', but I think every business ultimately wants solid auditing and reporting capabilities across their IT systems.
These concerns are only increasing in importance as new regulations demand stronger data provenance, but their implementation shouldn't be reliant on the process of "proper schema design" to get things right first time.
Databases built for the modern world should be making this stuff bulletproof and easy.
(I work on XTDB - and if Postgres already supported temporal tables I possibly wouldn't!)
I'm fully on board with XTDB and similar solutions for this reason. Most people still gravitate towards Postgres and similar databases without giving much thought to these temporal challenges, even though those options lack a robust solution for the temporal issues that so many systems demand.
_A few employees_ they acquihired support Datomic.
If those few employees quit, get fired, get transferred to some other project, etc., then no more Datomic support.
It’s perfectly reasonable to not want to use a DB that isn’t open source but Datomic isn’t a side project that’s on the edge of not existing.
It's a language aimed at experienced old school programmers, and doesn't aim to be friendly to younger less experienced programmers. They needed a better marketing team for the product.
I think Rich Hickey had a point when he said "[musical] instruments are made for people who can play them". I don't see people complaining about the piano or the saxophone being difficult for beginners. They are.
If it reaches a point of being documented and intended for general public use, then I’ll definitely try a project with it.
A bonus third factor is that the demos we've been cooking up internally—that we haven't revealed yet—are so f%cking incredible that everyone is going to be motivated to use and learn it anyway because Electric yields value that is previously unseen and unavailable anywhere else. So I am simply setting healthy expectations for success. For example, we just built the 80% that matters of the “sync engine” value prop in two weeks and 100 LOC. Implementing it in userland requires 1 LOC per query. With differential network traffic for over the wire O(1) remote incremental collection maintenance! for free! And the pattern works with any database!
Clojure (the core language) is developed in exactly the same way, Rich Hickey is pretty forthcoming with the approach they take. So if a framework with that approach gives you pause, probably Clojure the language should do the same. Relevant: https://gist.github.com/richhickey/1563cddea1002958f96e7ba95...
Also, code written for Electric is very specific to Electric. But Clojure is just functional-first Lisp. It's very easy to rewrite in another language, even an imperative language. There wouldn't be a huge paradigm shift translating Clojure to any of half a dozen popular languages.
You're probably thinking about the open source community developed project vs "it's not a democracy" aspect where Clojure is definitely in the latter camp.
investing your time in learning how it works so you can clone it might be worthwhile