How to Write Clean, Testable Code

Sign up for weekly Clojure tips, software design, and a Clojure coding challenge.

Reference: How to Write Clean, Testable Code

A good talk by Miško Hevery. I like his point that he likes constructors that have no logic. They simply assign data values passed to them to the appropriate fields instead of doing a lot of reasoning about the values. He likes to decomplect the logic from the data, and claims that it makes code more testable.

It reminds me of Clojure, where data values are typically built using literal maps. Clojure encourages a separation between logic and data construction and generally avoids this problem which is common in Java.