4 ms·
I agree in so far that creating those tiny functions doesn't help with eliminating the issue the author described. Namely, that a small typo can cause havoc. I
by waynesonfire 4y ago
I agree in so far that creating those tiny functions doesn't help with eliminating the issue the author described. Namely, that a small typo can cause havoc. I assume they were talking about the case statement logic. If you're dealing with a bunch of cases statements conditioning off various fields and also taking into account order, and maybe even logic of what combination of valid field values may mean, could be a recipe for disaster when it's time to start mucking with it. Creating a function per case is not going to help you deal with this.
With that said, I don't have a problem with small functions. If named properly can serve as documention for code readers, can hide and limit coupling of implementing details, ect.
> Inline code is _often_ easier to read and reason
Until it's not. And I don't understand when that happens but I know when it does.
- shikoba 4y ago> Until it's not. And I don't understand when that happens but I know when it does. It's very easy, as soon as the number of lines increase. I fix the arbitrary limit that a function should fit into a terminal to 72x24. Take your own limit.
- waynesonfire 4y agoSure why not! Love it. Interesting, as I thought more about this, I noticed that I evaluate whether creating a separate function would create a too large of cognitive load in jumping around, and if so, I'd inline, even if it exceeds the 72x24 rule. It's such an art. It's a sign of a master craftsman, when one knows when to break the rules.