4 ms·
I thought I hated small functions too, til I realized I just hated scrolling. The moment it's off my screen, it's out of my head. Assuming you just need helper
by jim-jim-jim 6y ago
I thought I hated small functions too, til I realized I just hated scrolling. The moment it's off my screen, it's out of my head.
Assuming you just need helper functions for f(), compare
int f(int x)
{
return g(h(x));
}
int g(int x)
{
return ...
}
int h(int x)
{
return ...
}
to
f = g . h
where g = ...
h = ...
Turns out my language choice was the problem, not over-abstraction. If you can fit it all on one screen, then have at it tbh.
- modeless 6y agoThe logical conclusion of this line of thinking is APL or K. Some people swear by it. I admit terseness is appealing for solo coding, and I loathe the bloat of Java etc, but when taken to the extreme terseness starts being a problem for collaboration.
- jim-jim-jim 6y agoI think you're right about those langs and collaboration; all the procedures are right there in front of you, but you gotta keep track of the data shape in your head. Just as much work as scrolling page-spanning functions imo. That's what makes point-free Haskell such a sweet spot for me: terse, symbollic control flow and nice combinators, but types to guide you. I try to use it as a better J.