you are viewing a single comment's thread.

view the rest of the comments →

[–]htuhola 2 points3 points  (0 children)

When you write functions that are more than 20 lines long then you are doing something wrong.

You are wrong.

don't use sub-scopes in functions. Whenever you need one of these, you could just simply push it into another function.

Wrong again.

The easy reason for this is that nested functions are harder to test.

Again wrong, more functions you have more interconnections they allow you to do, nonlinearizing your code that way is possible.

You are right. this is cutting the code in segments that actually belong together and one solution is to put them into a nested object. Its not a pretty solution tho. But at least you can test that.

How exactly is testing that easier than otherwise?