Jeffrey Bakker
1 min readMay 22, 2022

--

In cases where the spaces are separating different sections of a function that could be independent from each other, this makes sense. Other scenarios, not too much.

Most of the time I’m using empty lines in a function, it is to *improve* readability; I find densely packed text harder to read. Sometimes it looks cleaner to separate variable declarations from a block of logic that follows. Or to group logic that otherwise wouldn’t make sense by themselves.

Especially in languages like C, C++ or Objective-C, which require more lines of code to get things done, it’s not uncommon to write methods with dozens of lines of code. I couldn’t imagine writing them without empty lines, or having every function refactored if it’s more than a few lines.

As for the other negative comments, remember that a “smell” doesn’t mean there’s something wrong; it just means there might be an opportunity to improve, in some cases - based on a common identifiable pattern. Use your own judgment on a per-case basis, don’t attack the smell.

--

--

Jeffrey Bakker
Jeffrey Bakker

Written by Jeffrey Bakker

Professional geek. Wannabe cyclist.

Responses (1)