Why Not Emacs?

December 19, 2012

Every now and then a “hardcore” programmer comes and mocks you for using a “sissy” tool like Eclipse or IntelliJ. Real programmers use emacs and vim. If you are lucky and the other developer has some arguments and social skills, you are not mocked, but rather explained how you are wasting a lot of precious time with your IDE and once you get used to emacs or vim, you’ll realize how irreplaceable they are – it will be like going into the 3rd dimension and wondering how you’ve ever lived in 2D.

Zoom out. Eclipse and IntelliJ are pretty much Java-oriented (though there are plugins for other languages). So if you are using ruby, python, php, or whatever, then probably emacs is the best thing you can get. But let’s see what you absolutely need your editor/IDE to do for Java:

  • debug – number one priority. If you can’t put a breakpoint and run your whole application in order to simulate a specific case, then you are left with poor man’s System.out.println(..)
  • quick navigation through the code – if you can’t go to a class with 5 keystrokes (no mouse), if you can’t go back to where you previously edited, if you can’t see which classes subclass a given class or, most importantly – see which methods call a given method, then your code analyzing efficiency drops remarkably. And in a typical software project you read and analyze existing code way more often than you write new code
  • refactoring – you want to change a name of a method. Add or remove arguments. Move a class to another package. The IDE makes the appropriate changes everywhere in the entire project and you don’t have to go and rename stuff manually (missing some of the occurrences)
  • auto-completion – that’s important, but not because it saves you 4 keystrokes. It shows you the possibilities you have. When you work with an unfamiliar (or forgotten) API, you are not sure which method does exactly what you want. So you experiment by typing a name you suppose you need and read the attached documentation to that method
  • coloring and highlighting- syntax coloring is a basic thing, and is not that important. But highlighting – when you select a variable you must be able to see where it is used.
  • tools support – your project is build and managed with maven. You need your editor to be able to pull dependencies from the repository and attach them to the classpath. You need to be able to save parameterized build configurations as well. You need Tomcat/web server hot-swap/hot-deploy – changed code to be directly replaced at runtime. Checkstyle. Unit-test integration.
  • advanced search and replace – regex search, method search, wildcard search, etc. Priceless in many cases, in which you should otherwise create a separate program that handles to complex find/replacement logic

All of the above are of huge importance to productivity. I wouldn’t drop any of them (especially the “call hierarchy” feature, which shows which methods call a given method). How many of them are supported by Emacs? In its basic form – zero, but that’s not a problem – there’s JDEE, which provides some Java support. Does it provide all of the above? No.

At this point I can safely wrap-up the publication, because I’ve given the answer – I’m not going to use emacs because it doesn’t give me what an IDE does. But I know the arguments that people will bring up, so I’ll add some more paragraphs.

In emacs you can do everything. You can write a Lisp script that sprays pixie dust on the code and makes all bugs disappear. And you can implement anything that’s missing in JDEE. You can. You can also probably write your own servlet container and web framework. But that’s what you do at home, when bored and have nothing else to do. If you are working on a project, you don’t do these things. They take time, and this is time nobody is going to grant you in order to play with your favourite editor. And even if you do, they will be buggy and feature-poor at first.

In emacs you can type code really fast. I don’t know, probably faster than in Eclipse. You can define all sorts of shortcuts, macros and templates and write code blazing fast. And that’s great, if you are a typist. Programming, on the other hand, requires way more thinking and analysis than simply writing code. I don’t know the percentage of time of a developer is needed for the actual typing, but it’s less than 20% for sure. And by the way, you can define templates and shortcuts in eclipse, too.

So, you want me to use an editor that makes me use more time and effort to perform day-to-day development tasks, and to do that I have to spend a lot of time learning and customizing my editor (and then probably store the configuration somewhere safe, so that I can reuse it across computers/jobs)? And I know why you like that. Because it’s tough, challenging, and makes you stand out of the “masses” that use these lame IDEs. It’s not something most people would admit, it’s a psychological effect. And I have no problem with anyone using emacs or vim. Just don’t feel elite for that.

So, why not emacs for me? Because Eclipse is better for Java.

If you find the content interesting, you can subscribe and get updates


 

9 Responses to “Why Not Emacs?”

  1. You can always use plugins like:
    – Vimplugin
    – Vrapper
    – Viable

    with Eclipse ( These are Vim plugins for Eclipse / There should also be some Emacs plugins out there… ). And after some customization get the best of both worlds. :-)

  2. It is certainly silly to think using Emacs/Vim (or any tool, I would argue) makes you part of an elite.
    I personally use Eclipse for Java and vim for all the rest. In doing so, I want to believe I’m using the appropriate tool for the job, but I’ll never really know.
    There are many tools out there and doing a decent evaluation takes a fair amount of time.
    Ultimately, one have to choose his toolbet and try to be happy with the choices.

  3. butterflies!
    http://imgs.xkcd.com/comics/real_programmers.png

  4. I use both Eclipse and Emacs, but I use them for what makes each more powerful. most of my code editing is done in Eclipse, but there are many things that are more easily done in Emacs. Anything that requires non-trivial text processing (which is basically what Emacs is) can be done pretty easily there. I even wrote a “multi-shell” package that easily manages multiple shell buffers. Having a command shell that’s also a text buffer alongside other text buffers can be very useful.

    In fact, someone realized that there are some features of Emacs that would be nice to have in Eclipse, which is why the “Emacs+” Eclipse plugin was invented. using the right pieces of this makes me even more efficient.

    The point is to use tools for the jobs that make sense, and don’t assume a single tool is the best tool for every job.

  5. eclipse, pah, intellij kicks it into a top hat – and is 75% off as I type.

    Great blog btw.

  6. Very well said. I’ve used Eclipse for various things including writing my PhD thesis in TeXlipse, but mostly I use it for C++. While Eclipse CDT has some limitations compared to JDT because C++ itself is less IDE-friendly it still kicks ass of any editor I’ve tried so far, Eclipse and Vim included. In addition to the IDE features that you’ve listed I’d like to mention documentation tooltips and switching between a declaration and a definition (C++ specific).

  7. (I also posted this comment on javalobby)

    Most of the listed operations (name completion, code navigation, name highlighting, basic maven support) are implemented in Emacs if you’ll use the latest snapshot of CEDET package. Although, this work is still in progress, but I hope that we’ll get more results in this direction during the next few months.

    if you’re interested, you can look to my article that describes CEDET: http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html

  8. Well said “Because Eclipse is better for Java.”

  9. Excellent blog you have got here.. It’s hard to find high quality writing like yours nowadays.
    I really appreciate people like you! Take care!!

    Take a look at my web page … basement contractor toronto Ontario

Leave a Reply