The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Refactoring tip: no empty lines inside a function

Refactoring tip: no empty lines inside a function

5:00
To keep code elegant and readable, this lesson presents a refactoring technique consisting of two rules: (1) Don't have empty lines in a function, (2) keep the function short, with at most 6 or 8 statements. See how this can help keep each function focused on one responsibility.
Watch this lesson now
Avatar
egghead.io

To keep code elegant and readable, this lesson presents a refactoring technique consisting of two rules: (1) Don't have empty lines in a function, (2) keep the function short, with at most 6 or 8 statements. See how this can help keep each function focused on one responsibility.

Avatar
praveen

What was the editor being used?

Avatar
Paul

Once you refactor things into small functions, you end up with a lot of empty lines in your code. You didn't solve a problem, you just created overhead.

In reply to egghead.io
Avatar
Maxime

All these small functions just add some noise to the code. They are only used in one other function. They make this function more "readable" but the global code get bloated with useless functions. It bug me less in other language where we can tag a function as private or protected.

Avatar
Francis
  • Six statements seems pretty egregious
  • You'll end up with ludicrous fn names, like animateLastPointFromLeadingLine
  • Debugging this would mean dotting the file with breakpoints, huge time waster
Avatar
Vamshi

For me, its too many functions already!

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?