Code duplication detection might actually do what I want here… If it’s fuzzy/disregards function and variable naming.
OK, so I found it, at last. Correct technical term might be “automatic procedure extraction”. Here’s on PhD work on it and code duplication (PDF): https://research.cs.wisc.edu/areas/pl/theses/raghavan.thesis.pdf
So, you could argue that a function is “splittable” iff the procedure extraction algorithm can extract something from it. Then of course, just as with code duplication detection, the question is how aggressively to set the thresholds/tune the algorithm.
Still thinking about this one. I had this formulation of “functional core, imperative shell”:
All code should either:
- Organize composable parts; or
- Be a composable part
I wonder if 2) should rather be, “be a smallest composable part”.
Edit, factoring out side-effects with monads or tagless-final, would it increase composability?
Oh yeah, being splittable implies not being the smallest composable part.