Sunday, November 04, 2007

Tools of the Trade

A programmer's tool set and work bench are meant to help them leverage the full range of their skills on the code they are working on. I've been learning the power that a solid workbench and a few sturdy tools can put in your hands when they are used properly. One of my favorite books The Pragmatic Programmer: From Journeyman to Master has this to say about a programmer' tool set:
Tools amplify your talent. The better your tools, and the better you know how to use them, the more productive you can be. Start with a basic set of generally applicable tools. As you gain experience, and as you come across special requirements, you'll add to this basic set... Let need drive your acquisitions. (Hunt & Thomas, ch 3 para 3)
One of the most important tools a I can use as a programmer is a solid command shell. I knew many students back at Neumont that never touched the command shell. To be honest, it is sad that they have never been taught how to use this powerful asset. When I say command shell, I don't mean Window's meager cmd, but a full featured shell such as Bash or Ksh. Fortunately for Windows users, Cygwin allows the full usage of the Unix tools.

One of the first things I do to set up my development workbench for Windows is to install Cygwin and the tools that it offers me such as: ls, find, which, grep, sed, cron, tail, and the Bash command shell. It's amazing to me how much more productive you can be when you begin to learn the real power these tools have. I personally had been raised in a Windows environment where many people rely on gui tools and very few people knew how to do much at all on the command line. During my time in college I began to realize how inadequate the gui is when you need to do more advanced commands. For instance, it is not easy to find out what *.java files had been modified in the past week to include a reference to the swing libraries.

While I'm no expert yet at using these tools, I can tell you that they do indeed make your life much more productive when you are working with code. I have gained quite the appreciation for tail and grep when it comes to looking through log files to find what I need. Since I'm in the test world these two commands alone have saved me considerable amounts of time looking for errors and stack traces. One of the greatest things about the Unix tools though, is the philosophy of making tools that do one job well and allowing them to be chained together for even more powerful results. This allows you to use the tools in ways their creators never even imagined. I can search through files, sort them, remove duplicates, etc... all by piping a few simple commands together. It is definitely worth your time to learn how to use these tools to your advantage.

After you've had some time to get used to the command shell, you should look into working with a solid text editor such as Vi/Vim, or Emacs. While many people rely on an IDE to edit any source code, I find that with a good text editor at my side like Vim I can edit text much more quickly. I'll admit, I still use Eclipse for my projects, but I definitely use Vim for any text that I need to edit such as XML, properties files, config files, etc... What I would really like to find, is a good Vim plugin for Eclipse because now that I've gotten used to Vim's keybindings, I try to use them everywhere. It's hard to deny the power of a good text editor, and Vim allows me to work with text faster than I ever was able to before.

In the end, if you haven't given the command shell or a good text editor a try, you need to spend some time trying them out. I definitely suggest that you try multiple shells and editors and find one that is comfortable to you. Once you do that try to use them as much as you can, and as you start getting better at them you will see your productivity increase considerably.

Image credit:

No comments:

Post a Comment