Let’s stop telling programming newbies to learn Vim (or Emacs)

As readers of this blog know, I am a proud user of the third most baffling editor in existence. (Why third? well, I feel confident placing Vim as the 2nd, because while inscrutable, hand-twisting keybindings are difficult, in my observation modal editing is a slightly bigger mental leap for the programming newbie. The most serenely baffling editor of all is, of course, ed.)

I also spend quite a lot of time tutoring newbie programmers. One thing I do not advise them to do is to learn Emacs. Not right away, anyway. I have been guilty doing of that in the past; consider this my statement of repentance.

Here’s the thing: as I said, I pair with novice programmers pretty much every week. And I’ve come to realize that as a group, they are faced with a bewildering array of tools to learn. My typical tutoring student is trying to simultaneously master:

  • Ruby
  • Ruby on Rails
  • Assorted language mutts and DSLs like YAML, ERB, HAML, and SASS.
  • Git (the most powerful DVCS available, but also easily the most baffling from a UI point of view).
  • Z shell
  • RVM/RBenv
  • Homebrew
  • Vim

They are trying to learn all of these at once because they’ve picked up on the consensus opinion that these are all part of the best-in-class Ruby on Rails development toolchain. And they are right. But what they don’t see is that most of the people touting that toolchain learned it one piece at a time. In particular, most of the current crop of Vim users came to it after learning Ruby and Rails. Either that or long, long before.

I spend a lot of time watching novices trying to understand some core Ruby concept, and then get sidetracked by the fact that the editor just deleted five lines instead of inserting two characters. It’s hard enough learning a new (or first) programming language. It’s incredibly frustrating not being able to get the code that they think might be right onto the screen in a reliable fashion. It kills their forward momentum, and makes learning a new language a lot more of a drag than it should be.

By contrast, lately I’ve also seen a number of newbies using Sublime Text 2, often the free nag-ware version. They are much less hampered by the combined programming language / editor learning curve. While Sublime Text is a powerful editor in its own right, you can use it like Notepad and still get by just fine.  Typing characters makes them appear on the screen, cut-copy-paste has the keybindings you’re familiar with, and if you can’t remember the keybinding for re-indenting text you can mouse to it in the menus.

As of now, my recommendation for someone new to Ruby and Rails is to start out with a basic, GUI-based text editor with traditional CUA keybindings. Examples include:

Note that while I also use RubyMine occasionally, I do not include it or any other IDEs in my list. IDEs pose their own barriers to understanding, by hiding a lot of the command-line invocation and directory navigation without which much of the development process remains “magic”.

Once a novice achieves a modicum of comfort and fluency with the language and framework, then I do recommend they learn at least one of the “big two” editors well. A good programmable editor will grow with you for the rest of your career, multiplying your effectiveness as a developer. Yehuda Katz has a good article on making the transition to Vim without completely losing productivity; a similar approach is possible with Emacs.

But please, let’s stop telling total novices they should immediately learn (Emacs|Vim) because it’s oh so powerful and superior. It’s just one new tool too many.