Monday, November 5, 2007

Programming meets Editing

Editing text is a significant part of programming. Sure, you spend a lot of time thinking, and a lot of time scribbling on paper and white boards. But you do a ton of editing as well. The only way you can get out of editing is by getting out of programming.

It is interesting that, though editing is such a large part of programming, it is relatively ignored. In my Tools of the Trade: Keyboard post I pointed out that having a comfortable keyboard seems like it should be important given how much typing a programmer does. Along those same lines, it seems like having a good editor should be just as important, if not more so.

I think there are two kinds of programmers, those who have a favorite editor, and those who have never bothered to think about it. Most of the best programmers I know have spent a fair amount of time experimenting with different editors. As usual, wasting time messing with editors doesn't make you a good programmer, and I've known some extremely good programmers who never thought twice about it. On the other hand, generally the people who take the time to think about things like text editors are also the people who think about things like writing good code. I even think that would be a good interview question, "Do you have a favorite text editor?" You could learn a surprising amount about a person's background and actual coding experience through that question.

My favorite editor is Vim, gVim actually. I started editing in the Quick C DOS editor. Then later I used the Zeus editor. Then I stumbled on Vim. And of course, Visual Studio. I had friends in school who used UltraEdit, and recently I've read a lot of hype around Text Mate and the windows clone, E Text Editor. I have never personally used Emacs. I took some time to read about it not long ago, but I've never gone so far as to install it and spend time with it. I tried jEdit for a short period of time, but gave up on it because it took too long to start up.

In the search for an editor I find myself trying to figure out exactly what it is I'm looking for. What makes a good text editor. I think these factors are part of it:
  • Expressivity
    How much can I say and how well can I say it? Ultimately I want to be able to express at a high level what I want to have happen to the text.
  • Composability
    Are there a series of flexible commands which can be combined to perform more complicated operations?
  • Psychic ability
    Does the editor know what I'm doing and help me do it by abstracting out the tedious details? For example, Intellisense, snippets, and auto word completion.
  • Comfort
    Can I type commands easily, or am I performing acrobatic arts with my fingers on the keyboard?
  • Speed
    Is it faster than editing in Notepad?
  • Keeps me oriented
    Keeps me from getting lost in my files and directories
Interestingly these really divide into two categories, you have the strictly text manipulation issues such as speed, comfort, and expressivity. Then you have the more "management" and domain specific issues such as psychic ability and keeping you oriented. Vim is very good at the text manipulation parts, but weak in the management parts. Visual Studio on the other hand is very strong in the management parts.

Visual Studio with Intellisense and re-sharper's background compilation really is wonderful. Add the solution explorer to that and life is pretty good. I wouldn't use an editor that didn't have those features knowing that they exist in Visual Studio. Thus at work I use Visual Studio and not gVim.

Because of this I think I'm going to spring for a ViEmu license. I've used it for the trial period twice now, once on my old computer, once on my new computer. Each time I love having it, but its pricey so I haven't committed yet.

What editor do you use? What editor do you wish you could use?

3 comments:

  1. I <3 textmate. I actually paid for a license fr it which says a lot considering how infrequently i like buying software.

    It includes an extensibility concept it calls bundles which lets you plug in metadata / code completion stuff for different languages (or even frameworks as is the case with ruby on rails). Most of the popular ones come with it (php, ruby, rails, c++, java, etc.) but you can also write new ones... although i cant seem to find great documentation on how to do so.

    I recently started learning ruby and textmate is great. It includes keystokes to run and debug ruby apps. It also has a "project" concept similar to VS where you can heirarchically save a set of classes under a project and then move it around independant of folder structure.

    There is a ton more i havent learned yet but its deff. my favorite. Rumor has it v2 will even have intellisense included into the bundles thing.

    Of course i love VS.NET too for doing .net work. I can't lie microsoft made a hell of a product with that IDE.

    ReplyDelete
  2. currently I use IntelliJ IDEA (from the makers of Resharper) at work which is a full fledged IDE that supports plugins, projects and basically everything. I like it a lot and have been learning more and more what it can do as I go along (beyond the initial, wtf how do I get my work done, phase).

    In the past, for java and other development I primarially used Eclipse which too supports tons of plugins and can be an editor for pretty much anything (its really just a framework that you can download with java plugins for editing, projects, etc).

    Both have tons of editing features, plugins, refactoring tools, intellisense (at least for java), etc. But Eclipse is free and IntelliJ is $$$. But IntelliJ is more polished in my opinion.

    as far as pure text editors are concerned I learned Vim mainly from your pushing Kevin, and still like some it for just text editing, but for java development I want the fully "inteligent" IDE. Knowing Vim is always helpful when you have a problem on a Unix server and need to go view and modify some config files somewhere via ssh.

    Other than that, I have used various other windows editors (Crimson, UltraEdit, ....)

    I haven't tried Textmate but have been meening too. Tons of the guys at NFJS use it.

    ReplyDelete
  3. The only thing the IDEs and Textmate style editors lack is the text manipulation features you get from editors like Vim and Emacs. That being said, Visual Studio has Emacs and Brief emulation built in. I considered learning emacs just for that reason. When I read about it it sounds like VS's emulation is decent but not perfect.

    In the end, I just really like Vim's modal style. I love the way you just live on the home row keys instead of constantly performing acrobatic stunts with control and alt.

    I imagine that Textmate and Eclipse and IntelliJ IDEA also have a lot of these kinds of features. These are the things that give you the expressivity, speed, and comfort. That's why I'm somewhat surprised more people don't take notice.

    In any event, I'm always looking for better ways to edit programs.

    ReplyDelete

Note: Only a member of this blog may post a comment.