I feel like I have no position to argue this, but I felt clojure applied had to much of an emphasis on records, in creating new types. The first couple chapters end up modeling almost everything with records and if i recall, the justifications were all performance based. I feel specs fill the role of modeling (communicating or restricting) the domain better, which would leave records purpose as a means of polymorphism (and i suppose performance enhancers). I’m happy to hear differing opinions
I need to find the time to work through a larger clojure project and see how things come together though.
I feel modeling a system in Clojure is straight forward. It almost makes it harder to get things done because you can find yourself imagining more and more ways to solve the problem and its actually possible to do them (or to bounce between them). It can be very distracting…
@drewverlee well, afaik spec is a recent thing, the book is from 2015.
I find value in Recods when you need to have polymorphism based on fixed structure, such as "financial transactions data", and spec as a means to validate what can go inside my fields. But, I'm a clojure newbie, so there might be an obscure way of doing it.
Comming from Elixir, which has a similar thing as Protocols, which dispatch on "type" (a struct, since Erlang have no strong types), that's where I find value, at least.
Your right the book came before. I’m not sure that how that would have changed things. I agree with your assessment. I felt that the authors reached for records almost immediately, without a strong use case. The book “Clojure polymorphism” Goes into this topic at depth, its a book that requires a couple reads and explores a lot of subtle tradeoffs.
@drewverlee this book? https://leanpub.com/clojurepolymorphism/
@imetallica yep! 🙂.
Gonna take a look. 🙂