I watched Full Stack Teleport Testing today. In it António Monteiro and Mike Kaplinskiy note that you can clone datomic using the with() command. with() produces a speculative version of the DB or a simulation if you will. And because that new database value is also a full database, it can be changed separately from its parent state using a new connection.
So why was I even surprised that you can clone datomic that easily? Honestly I don’t know. I should have internalized by now, that immutable data brings these great benefits. But somehow I haven’t. So the following is also a reminder for myself:
Efficient accretion, cloning and essentially time-travel are possible when working with immutable data. This pattern is frickin‘ everywhere!
File System – ZFS: Sun’s Zettabyte file system. A copy on write and thus immutable file system with extremely cheap and efficient snapshotting.
Source Control – Git: Linus Torwald’s source control management. Commits are immutable. And storing files in immutable blobs instead of a delta-history is ten times more efficient than say CVS.
Application State – Persistent data structures. Clojure is certainly not the only language to provide these data structures.
Database – Datomic as mentioned above
Surely there are domains and systems that can’t afford to or don’t have to be immutable. But if a system has a lot of memory available and has to deal with time, there is no better way to do this than with immutable data.
We cannot seriously call ourselves programmers if we don’t at least look at this possibility when building a new system.
And in Rich Hickey’s words:
„We can take a different approach to the way we do things.“
„We can afford to spend memory to simulate time.“
„We’re living in the space age.“
Ein Gedanke zu “The Space Age”