clojuredesign-podcast

Discussions around the Functional Design in Clojure podcast - https://clojuredesign.club/
2020-06-09T13:06:16.084100Z

In episode 73, among some very informative information about websockets, there is some discussion around naming and when to use a function. I believe the example given is that you decide to create a function that calls assoc. As am example consider:

(assoc solar-system :planet "earth")
to
(defn add-earth [solar-system ] (assoc solar-system :planet "earth"))
This raises the bar for participating because its using a language that isn't in the standard language. That can be worth it, primarily to share logic, as comments can fulfill the same role of explaining what something does. But if you need to share logic, then a name should aspire to revel intent within a context but also hide details. "add-earth" hides details i need, forcing me to open it up and look at the details, because i don't know what collection it takes, what data it really adds, etc... A better function would be "add-to-map" which tells me what it needs at the action taken on it, but we have that already, its assoc.