If not AST, edit whole lines at least

The more I learn Eclipse, the less I code by processing raw text. More often than not ctrl-space or ctrl-1 offer just the AST manipulation I need, if I just remember to stop typing and use them.

But there is another level, too, between AST and character: when editing raw text, I edit whole lines instead of individual characters whenever possible.

For example cutting and pasting whole lines can be done with very few keystrokes: just put the cursor at column 0 and press shift-down to select some lines before cutting them. Then move the cursor up or down before pasting, again at column 0. Cutting partial lines needs more keystrokes and requires extra formatting. I've seen people do a lot of ad-hoc adjusting (every time a different variation!) after each paste.

Line-oriented editing is good for version control, too, because most diff tools compare whole lines. This is another reason why it's good to add a comma after the last enum constant: this way adding a new constant is only a one-line diff, since there is no need to modify the previous last line.

This is also one more reason to add a linebreak after the last line!

Originally published on 2009-06-30 at http://www.jroller.com/wipu/entry/if_not_ast_edit_whole under category Eclipse