Skip to content

MakeTheUnmistakableVisible

Ben Christel edited this page Sep 5, 2022 · 1 revision

Design technique: if there's a concept in your code that has an unmistakable representation, push that representation as high in the dependency tree as it can sensibly go, so it's visible.

For example: console.log in JavaScript is pretty unmistakable. Everyone writing JavaScript for the web knows what that does. So which of the following is more explicit?

# option A
const getSchedule = cache(wrapWithLogging(generateSchedule))
# option B
const getSchedule = cache(pipe(generateSchedule, tap(console.log)))
Clone this wiki locally