I’ve recently read over this article linked in a recent newsletter and spent some time pondering:
Most of the comments there are over a week old, so I thought it might be worth continuing the discussion here where it might get more exposure.
I have to say, this article has distilled some of the same issues I’ve run into working with Clojure. One of those issues which specifically I have not yet found a solution for. When looking at a function buried deep in a project, there’s no easy way to know the shape of the data coming in or going out. And there’s no agreed-upon way of conveying that information. Tests? Doc strings? Commented code examples? Commented snippets of example data?
For example, with a statically typed system, I can see the structure of a type with a click or a keystroke, and that immediately sets the context for the function in question. Good names help with this, but there’s no substitute to seeing the parts of a data structure defined next to where it is used, such as a pop-up window in an IDE.
There are 2 suggestions I have on how to deal with this issue, one old, one new. Spec is the new player on the team, and we will have to see how tools evolve that will use spec to possible show type-like information where relevant. But I also think more use of Clojure records would be helpful. If a record is defined and used rather than simply a map, and then functions are well named (another good suggestion from the article), this helps the reader develop the mental context needed to understand a given function.
What other suggestions might be useful for this issue? And what other comments do you have on the article overall?