Go to content Go to navigation Go to search

Shrink your editor window

I used to work hard to get as much code onto the screen as possible – reducing font sizes, maximizing windows. Recently I’ve been working on going the other way – minimizing how much code I need to see at one time.

You see a lot of college coding standards that require you to limit your code to 80 columns but in the professional world this is rarely encouraged. Most coding standards focus on braces and naming conventions. The antiquated technical limits of 80 columns per line have long been removed, but it’s still a goal that leads to cleaner, more understandable code.

Minimizing the amount of code you need in view at one time naturally leads to composed methods – short simple methods with all code at the same level of complexity.

Long lines are usually caused by two factors – complex expressions and deeply nested conditionals or loops. Can you take that expression that pushes the code out to the margin and rewrite it in two lines instead of one? Does it make more sense to factor out a subexpression into a helper function? Can nested loops be rewritten as separate functions?

I switch on an 80 column print margin in Eclipse, showing a thin vertical line at the edge. In Emacs I size the window to 80 columns. If a piece of code seems unnatural at 80 columns I of course allow it to fill the space it needs.

  Textile Help