TheJoyOfHack

For people who like to make things

As of this past weekend it’s been fifteen years since I started my career as a software developer.  With the exception of a few months here and there, I’ve spent all these years working on Linux or Unix-like operating systems.  I’ve noticed that despite the wide variety of tools and applications I have used and continue to use, some key skills are always in demand in this field. One of these is mastery of a text editor.

The emacs editor
The emacs editor

In their book “The Pragmatic Programmer,” Andrew Hunt and David Thomas stress to “Use a single editor well. The editor should be an extension of your hand; make sure your editor is configurable, extensible, and programmable.”  I couldn’t agree with this more.  A good editor is a very flexible tool.  Once you become an expert at it, you can use it to accomplish tasks almost as quickly as you can think of them.  You need to process a file as a one-off?  You could write a perl or python script, or an awk/sed one-liner, but often you could also do it in an editor - with the benefit of ‘Undo.’

A good editor is configurable, so that you can use it the way that works best for you.  Most editors have more than one way to do things, and there is no right way, just the way that works for you and helps you reach your goal quickly and efficiently. A good editor is extensible, so that it can grow along with your needs.  You need syntax highlighting for the new programming language that was invented after your editor?  You should be able to go online and download an extension module - or write one yourself.  A good editor is programmable.  Your job requires you to document functions and change histories a certain way - your editor should allow you to change its behavior, so that you don’t have to repeat the same kinds of tasks over and over again.

One of the best ways to learn what you can do with editors is to watch others. Do you have a coworker whose fingers fly across the keyboard while she bends text files to her will? It may not be just that she’s a fast typist - she’s probably really comfortable using her editor.  Search for these people, ask for advice and take notes.  Try different options out, pick an editor, and invest the time to learn it well. You’ll be doing your career a favor.

There is no real correct answer to the question “Which editor is best?”  But there is one absolute: If you work on a Linux or Unix system, you must know how to use the vi editor.  This is because every Linux or Unix system has at least that one editor installed.  Depending on your line of work, it may not be unusual to find yourself on a machine that has only that editor installed.  I started off using vi in college and took the time to learn it well. Years later I found myself in a short lull while switching from the IS41 to the VLR products at Motorola. I took advantage of the downtime by teaching myself emacs and have been primarily an emacs user for since then (about 11 years now). While I prefer emacs, I still use vi every so often, and consider myself fortunate because I know both.

There are many other editors out there and a lot of them would probably meet Hunt’s and Thomas’s criteria, but I would like to add one more to their list: A good editor must be usable without a windowing system. I have also played the role of system administrator, and none of my hosted machines ever had a windowing system installed. This means I could not run eclipse or even jedit. The only editors I could install and use were ones that would work in a text window (an xterm). So it was either vi or emacs.

Pick a good editor, one that meets the criteria listed above, and learn it well. Spend the time to become an expert. The time you invest will be paid back in increased productivity, power and flexibility.

Real Programmers - from http://xkcd.com/378
Real Programmers - from http://xkcd.com/378