Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>Because I need to know what they actually do?

Strange. The longer I've been programming, the less I agree with this.

>For even a simplest helper, there's many ways to implement it.

Sure. But by definition, the interface is what matters at the call site.

> That's how you often get accidental O(n^2) in random places.

Both loops still have to be written. If they're in separate places, then instead of a combined function which is needlessly O(n^2) where it should be O(n), you have two functions, one of which is needlessly O(n) where it should be O(1).

When you pinpoint a bottleneck function with a profiler, you want it to be obvious as possible what's wrong: is it called too often, or does it take too long each time?

> If the helper fn is otherwise abstracting a small idiom, I'd argue it's only obscuring it and providing ample opportunities to screw up.

Abstractions explain the purpose in context.

> I'm more of a "don't do stupid shit, you'll have less bugs to fix and less performance issues for customers to curse you for" kind of person

The shorter the function is, the less opportunity I have to introduce a stupidity.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: