3 ms·
Fun read. What happened to the conditional expressions? Move them to the interiors of doX() and doZ(). That was an interesting point. Not sure that it's a
by keyle 3y ago
Fun read.
What happened to the conditional expressions? Move them to the interiors of doX() and doZ().
That was an interesting point. Not sure that it's always valid but I guess it depends where you want the abstraction to lay, and how it affects the mental construct around the code.
e.g.
deleteRecords();
is not better than
if let x = deadRecords()
deleteRecords(x);
Sure, it looks messier but there is value is showing upfront that you're pruning and not wiping.
If the author wisely renames his function e.g. pruneDeadProjects(), yes. But merely moving the the condition within the function can be dangerous for context and be a leaky abstraction.
- WalterBright 3y agoFinding the right abstraction isn't always easy. Sometimes if I just put it down and let it slosh around in my brain for a few days, it comes to me. Like your idea of pruneDeadProjects()!
- tmtvl 3y agoThe programming strategy of "less typing, more thinking", it's a good one for avoiding RSI.