Relaxing at home on the couch is another time that I'm not in a rush. I've largely replaced evening TV time with watching presentations on various topics. InfoQ is perfect for that. I get to have an expert take an hour to carefully explain a topic that I'm only tangentially interested in while I semi-nap on my couch after dinner with a beer. This has become a low-effort means for me to gain a high-level understanding of a broad range of topics that I wouldn't otherwise have the time or willpower to sit down and actively study.
It surprises and disappoints me that he is not as well known nor revered as the agile craftsmanship peddlers.
What rich says, on the other hand, is pure gold as you said. But it needs to be understood before its value is seen.
It's hard to sell to the manager who has no clue what all of this means, even harder to compare the tradeoffs with their current approach.
I felt rather bad afterwards for having done so. One of the more useless talks I've attended. Very superficially prescriptive (you should do X; Y has seen benefit Z), with no meat to the description (or prescription, as it were).
Agile may well have its place. But its intersection with BigCo life, as anecdotally exemplified in this fellow, seemed to be just more of the "same old same old". New words, same shit.
Actually, he is better known than all those guys selling snake oil.
A functional DB replaces a "row" that only holds the current state of the world with a list of timestamped "facts" that can represent either the present or any point in the past.
Instead of simply recording "Bob's favorite food is pizza," we record that "'Bob's favorite food is pizza' was added at Time X." If Bob decides his favorite food is now ice cream, we record that "'Bob's favorite food is ice cream' was added at Time Y." At any time, we can query Datomic to get the current state of the world--"Bob's favorite food is ice cream." But note that we can also query Datomic to get any past state of the world. If our query is "what was Bob's favorite food 10 minutes before Time Y?" the response will be "pizza."
A regular database is like a sheet of paper that is continually erased and drawn over with a new world-state. Datomic, as a "functional database," is like a flipbook with an updated state on every page.
Every production database I've ever seen goes through some version of the same evolutionary lifecycle:
1. "We only need the current state". The database acts as a snapshot of the current world. Updates cause the loss of historical data. The database is like a state machine.
2. "Oops, actually, we need point-in-time reports". The database is hacked with date_from and date_until fields (which introduce interesting anomalies and impose programming overhead on every query written).
2a. "This is a mess, let's clean it up". The database schema is refactored so that the central model is logs of transactions. Point-in-time snapshots are derived at query time. Note that this both replicates the underlying logic of database design (much as network protocol layers are fractal). Note also that it recreates the way basic accounting works, which was the inspiration for database transactions.
3. "Oh crap, the regulations/laws/reporting standards changed". Now you need yet another layer to represent changes in the domain, not just in the data. Your point-in-time reports become even hairier as you must now write different queries depending on the time period being accounted for; and sometimes you must write queries that span both periods and include logic to combine them.
The concept of a temporal database is to make points-in-time a universal, cross-cutting part of everything that happens to the database, either in the schema or the data. Rich has correctly identified the correspondence with functional immutability, where instead of modelling things as having mutable state, you model changes as a series of successor models, each of which is by itself immutable.
I think it's a good idea. The world would be very different if proper temporal logic had been baked into SQL in the first place.
... which isn't 'functional' in any sense. It seems that Hickey just reinvented time series and tries to sell those as database.
Functional programming is very closely tied to the notion of immutable data. "Don't modify data in place" is one of the pillars of the functional model.
> It seems that Hickey just reinvented time series and tries to sell those as database.
Datomic is much more than a time-series, although that's the aspect that arguably makes it "functional." For example, it provides a datalog query interface and has a pretty fascinating and unique architecture that provides extremely high scalability for queries. If you don't like Datomic, or if it doesn't suit your purposes, or if you think it's overpriced for its value-added (I do), that's cool, but don't dismiss it based on a malformed understanding of what it is.
The purpose is not to follow a changing quantity, but to formalize state and value. The idea is that any entity's state, at any given moment in time, is an immutable value. You can query the state at time t0, get a value, and examine it or process it for as long as you like. You can then query it again at time t1, and get another, immutable value.
I guess this is a dual way of looking at time series data, with a different emphasis. The time series is intended to help with processing change, while a persistent data structure is intended to help working with a snapshot of the world as it existed in a specific instant.
query :: Query -> DBValue -> Result
instead of performQuery :: Query -> IO DBConn -> IO ResultIt's just an advert of Datomic.
(SELECT
("id", "login", "first_name", "last_name")
FROM (users)
(WHERE
(and
(or
(eq "login" login)
(eq "email" email)
)
(eq "password" (bcrypt password))
)
)
)
(Sorry, couldn't fit more parentheses in this)SQL -> Datomic?