Why Not Emacs?
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.
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)