Sunday, March 22, 2009

Software Hygiene: Your Editor is Important

This entry is part of a series called Software Hygiene. The idea comes from a whitepaper I read back in the 70s or 80s called something like "On Brushing Ones Teeth, Hygiene in Software Development". The overall point was that though methodologies and languages can be important, the habits you have are very important also.

Why does the editor matter? Why are there endless debates about Emacs vs VI to this day? The reason is simple, if you develop software you will spend a huge amount of time working in your editor. As editors have become Integrated Development Environments (IDEs) this has become even more true. Of course many reading this will not know that editors did not always allow you to launch a debugger. So given that you are going to spend some serious time with your editor, you should at least get to know it.

One of the first things I do with my editor is change the color scheme. The default color scheme is designed to look good, especially from a distance. It is designed to attract your attention to an advertisement for the IDE. Sorry if this seems negative, but this is how business works. So you should try some things. You will notice that I am not telling you what color to make your editors background. I'm not because I don't know. The goal is to make the screen you are going to be stairing at as pleasent as you can. You should try some different color schemes and see what sticks. You may find that your eyes were suffering and you did not even know it.

Obviously, colors are not the only aspect of the editor that matters. Modern editors have all kinds of interesting and clever ways they can help you. One aspect you may not have thought of, and that is the key bindings. An extream approach is to try a completely different key set. I like to use the VI key bindings myself. Still, before you change the world, consider the things that you do often. There are likely things that you do often that do not have an easy keyboard shortcuts. Every time you take your hands off the keyboard to use the mouse, your flow is interupted. Perhaps it is not a big deal, but why take the hit? Why not spend a few minutes to setup a keyboard shortcut so you can use it and keep moving. Another idea along the same lines is to find out how your editor uses templates. They may not be called templates, but most editirs have a method for expanding a few characters into a block of code. Again, most of us find that we write similar peices of code over and over. Of course the ultimate version of a template is a project template. They will typically write multiple files worth of code at once.

At this point most people talk about how they don't know how to do any of this. I appreaciate that these ideas can be time consuming to learn about. Still consider the return on your investment. Spend an hour or two working through how to build a template that will save you 10 minutes. If you use that template three times a week, inside of a month or two you have made up the time, then you are getting ahead.

It is interesting to me how little most developers know about thier tools. A carpenter has likely tried a dozen or so different hammers. They know the wieght, length, etc of the hammer that is right for them. They do this because they have a hammer in their hand all day long. In the case of the capenter they can actually become injured if they use the wrong hammer. Fortunately, as a software developer it is unlikely that we will be injured. However, we can all stand to have a little more time in our schedule. So spend the time to get to know your editor, or take the plunge to find an editor that you really love.