2 ms·
This depends a great deal on the language used. Breaking a large function apart into several smaller pieces makes testing them easier, and (even more important
by silentbicycle 18y ago
This depends a great deal on the language used.
Breaking a large function apart into several smaller pieces makes testing them easier, and (even more importantly) lets one name them. A well-named function is generally better than a block of code in a function with a one-line comment before it, IMHO. (Of course, there's nothing stopping you from giving all of functions names like doThatStuff() besides the eternal scorn of your peers.)
It can be annoying in languages that require a lot of type annotations just to declare a function and have poor support for nested functions, though.