Re:Write code. Not too much. Mostly functions.
by bitexploder on Monday December 21, 2020 @08:56PM
(#25502027)
The key concept they always helps me is to minimize side effects per function. One thing goes in, one thing comes out (in an abstract sense). Multiple side effects starts getting dodgy as it makes the function harder to predict and reason about. I do err for longer easier to read functions. And don’t compose into functions until it’s clear you will actually reuse the code or you actually need to reuse it :) DRY is good but premature composition is just as annoying as premature optimization.
[ Parent
| on HN ]
Re:Write code. Not too much. Mostly functions.
by chrisweekly on Monday December 21, 2020 @09:03PM
(#25502074)
Yes! "AHA" (Avoid Hasty Abstractions) is the remedy to too much "DRY".