re: What programming best practice do you disagree with? VIEW POST

TOP OF THREAD FULL DISCUSSION
re: It's not only about abstractions nor length. If a function becomes too long the engine won't be able to optimise it if the size of the bytecode gen...

Oh for sure. If you take a performance hit in some critical piece of code, you may not want a really long function.

I just wanted to point out that there isn't anything inherently wrong about having a long function. We are often taught to break logic into separate functions even when there are plenty of situations where it doesn't make sense to do that.

Agreed. I wanted to add a different perspective to the discussion since most of the time the points that are focused on are abstraction, readability/testability, and length.

There are times when it's necessary to make functions long, and others to break them up into smaller units, as long as doing so has a measurable impact, makes the logic involved clear, and goes according to project goals.

code of conduct - report abuse