Jonathan Cogley posted on how he believes that whitespace in your code is a code smell. Thinking about this concept, I can’t agree fully one way or the other. I think that there are some situations where whitespace is most definitely a code smell and I think that there are other situations where whitespace is nothing more than a tool to reduce the strain on your eyes.
For me, whitespace used for the logical breaking of code within a single function is a sign to me that there may be opportunities for method extraction. It’s a lot like using a region in Visual Studio, but without the collapsibility feature.
Look outside the methods though and you’ll find that whitespace between methods, XML documentation, properties and instance fields is a way to increase the readability of the code. By readability I don’t mean that the code becomes easier to grok. Instead I think that whitespace makes it physically easier to read large segments of code.
As an example, look at a newspaper. Editors and layout designers put a lot of thought into the whitespace on every page of their papers with two exceptions. Classifieds and Stock Quotes. I can read any business or world news page quite easily. If I look at the classifieds section I have to strain to even make sense of what’s going on. I need to concentrate a lot harder to work my way through the entries and columns. It’s a more taxing experience than reading the other sections of the paper.
When turn code over to a maintenance team, I need to be comfortable in knowing that they can pick it up and work with it effectively and efficiently. What Jonathan said about refactoring instead of using whitespace definitely is one of the dominant and more correct ways to accomplish this. Don’t discount that whitespace is a factor too. Developers will unknowingly be thanking you for incorporating it into your codebase.