
Fred Overflow
5 HN recommenders · recommended in 13 months, 2020–2026
4:57 · 43K views · Nov 30, 2019
A five-minute excerpt of Rich Hickey's Clojure Made Simple talk, with new slides, ranting about HttpServletRequest and specificity. He argues for using generic maps instead of many specific classes and getters.
Cited as the classic rant on maps versus objects in discussions of data modeling and OOP.
14 comments from Hacker News
Rich Hickey "thinks in lisp". For example, he talks about his "maps" data structure (aka association lists). See this video Since data and programs are the same thing in lisp you can fluidly shift from one to the other, like I did with "knowledge" vs "rules". They both have the same representation (defstructs) but they are also code and have execution semantics. Clojure allows you to do this with map objects. The fact that you can use the whole language on everything at any time and that everything at any time is also "the language" is how you "think in lisp". Nobody thinks of Python programs as "data" or data as Python programs. Watch anything Rich Hickey talks about. He really "gets it".
A classic rant by Rich Hickey: this video I say this even though I don’t usually code this way: I think the big benefit for business code is sort of a constrained flexibility. Objects tend to get really big (the alternative is you have a ton of classes). Think about all the data that makes up one Uber ride. So if I want to do anything with a Ride, I need everything. An even the many classes thing doesn’t really solve that because maybe what I want is cross-cutting. So either way, I just end up having to supply a bunch of stuff I don’t need. The maps-first approach is more incremental. Every function takes what it needs and gives what it can.
> Do people actually build large codebases with the 'hash map first' approach? There are a few large projects written in Clojure. I'd say it's a "data first" approach, not uniquely "map first". There's this famous 4 minutes rant by Rich Hickey (the creator of Clojure) where he talks about maps and about how Java does OOP (and how maps are served through getters but you can't see easily that they're maps), it's golden: this video
> I personally find OOP to be the most intuitive for large scale systems design, but that's just me. At one point, I was the same. But after going functional in Clojure, I can’t imagine going back. Using maps nd just having common functions that transform data into different data is definitely the way to go. This is with your time: this video
I like "Clojure, Made Simple" even more. [LINK] Someone helpfully pulled out this chunk, which is a good illustration of why data is better than functions, a key driver of Clojure's design. this video