Rediscovering TDD and VIM
I’m writing tests first again. It’s easier when you have a guide that pretty much tells you what to test in the form of a cob_spec integration test. I noticed that thanks to the short feedback loops that TDD calls for, I was making less mistakes, and felt less scatterbrained. It really helped me focus.
Now I have all cob_spec tests passing and am working on adding unit tests for the classed I did not create using TDD. I’ve realized that I tend to really enjoy refactoring. Once all tests are passing I can focus on improving the design, which is what I usually find most interesting about writing software. I guess that’s another reason to use TDD, I can spend more time in that “mode”.
Thanks to my pairing session on Friday with Kevin I’m also thinking more about VIM and how to improve my skills with it. I notice during our pairing session that I spend too much time in “Insert” mode, and that I was slow because of it. In an effort to start taking my VIM practice more seriously I stumbled across Bram Moolenar’s: Seven habits of effective text editing. The primary contributor to VIM suggests three basic steps to gradually improve one’s skill in text editing:
- While you are editing, keep an eye out for actions you repeat and/or spend quite a bit of time on.
- Find out if there is an editor command that will do this action quicker. Read the documentation, ask a friend, or look at how others do this.
- Train using the command. Do this until your fingers type it without thinking.
So I think for future blog posts I’ll start including a section of editing behaviors and VIM commands to optimize those behaviors.
- navigation -> h, j ,k ,l (not arrow keys)
- faster navigation
- w, W = first letter of next word.
- e, E = last letter of current/next word.
- b, B = first letter of previous word.
- distinction = caps goes to next space, lowercase next word.