I have a particularly stupid uncertainty about the aesthetics of my code ... my use of space is frankly uncomfortable. My code looks like geek dancing; not really scary, but uncomfortable that you feel bad, but you can’t look away.
I'm just not sure when I should leave a blank line or use a line-end comment instead of a line comment above. I prefer to comment above my code, but sometimes it seems strange to interrupt the stream for a three-word comment. Sometimes throwing an empty line before and after a block of code is like putting a speed hit in the otherwise smooth part of the code. For example, in a nested loop separating three or four lines of code block in the center, the visual indentation effect almost vanishes (I noticed that K & R edges are less prone to this problem than Allman / BSD / GNU styles).
My personal preference is a dense code with very few “speed bumps,” with the exception of functions / methods / comment blocks. For complex sections of code, I like to leave a large block of comments telling you what I'm going to do and why, and then a few “marker” comments in this section of code. Unfortunately, I found that some other people usually use generous vertical white space. On the one hand, I could have a higher density of information, which, according to some others, does not flow very well, and on the other hand, I could have a better current code base by reducing the signal-to-noise ratio.
I know that this is such a petty, stupid thing, but this is what I really want to work on when I improve the rest of my skills.
Can anyone suggest any hints? What do you think is good flowing code and where is it appropriate to use vertical empty space? Any thoughts at the end of the comment line for two or three word comments?
Thanks!
PS Here is a method from the code base I was working on. Not my best, but not my worst.
public CommandThread[] generateCommands() throws Exception { OptionConstants[] notRegular = {OptionConstants.bucket, OptionConstants.fileLocation, OptionConstants.test, OptionConstants.executable, OptionConstants.mountLocation}; ArrayList<Option> nonRegularOptions = new ArrayList<Option>(); CommandLine cLine = new CommandLine(getValue(OptionConstants.executable)); for (OptionConstants constant : notRegular) nonRegularOptions.add(getOption(constant));