Is Bespin the 21st century text editor?

Integrated Development Environments are one of the primary tools of our trade. But personally I think an IDE can only be a good product if it has a robust text editing component. The king of text editors is Emacs. No offense to Vi users, but the Emacs + Elisp combo is unbeatable in my opinion, for a number of different reasons, programmability being the main one. Of course Emacs does have its problems. Steve Yegge discusses these problems quite thoroughly in his post on XEmacs. What’s interesting is that he claims that if Emacs doesn’t get its act together and fix its problems, it won’t be long before a browser sprouts enough editing capabilities to eclipse Emacs. I think that time is close at hand.

Enter Bespin. It’s a Mozilla project that is still under heavy development, but there’s a public demo already available. Bespin is an online text-editing environment written entirely in open source JavaScript. It’s provides syntaz highlighting and some project management and looks really slick by making use of the HTML5 canvas element. The best way to understand what Bespin can do would be to watch their introductory video:

It may not be immediately obvious what all the fuss is about if you’re used to using a modern IDE like Eclipse. After all, it’s just a text editor, right? Yes, it is just a text editor and that’s where the beauty of it lies. Firstly, t’s programmable in the Emacs tradition. That means that you are allowed and encouraged to write your own bits of JavaScript to adapt it to work the way you want to. Secondly, it’s sports an open server API which means that you could potentially use Bespin as an editor-like interface to anything you want. This has already led to Bespin running on top of the Eclipse IDE. Eclipse acts as the server and Bespin acts as the editor interface to it. Here’s a screenshot of Bespin+Eclipse in action showing Eclipse communicating errors in the Java code that Bespin is editing.

Keep in mind that Bespin is still in a very experimental stage. However, the example above is clear evidence that Bespin is going to be a force to reckon with in the IDE sphere soon enough. I think that bringing a client-server model to IDEs is going to offer a significant productivity improvement to programmers especially as developers and companies have to wrangle increasingly complex, heavy weight codebases.

Development machines need to be real monsters nowadays to efficiently handle the demands of the software being developed. Using Bespin, developers could invest in industrial strength servers which serve as both code repositories and build farms. The developer’s machine then act simply as terminals or can run local lightweight server instances for the Bespin frontends to connect to. This means that developers can afford having cheaper machines themselves, but don’t need to wait for long compile times as they’re being outsourced to the powerful servers. Code is also centrally stored meaning that it can be pulled up a moment’s notice and worked on collaboratively. This could mean more efficient workflows for software companies.

But the biggest win would be for the developers themselves. Here is how I can see myself using Bespin: I’d have a machine sitting in a safe, well connected location running a Bespin server. This would be my main development machine so I’d trick it out with as much RAM and processor speed as I could afford. The server itself might be some form of headless Eclipse or something equivalent for whatever language I happen to be progamming in. The cool thing is that since there is an implementation agnostic server API, I could even write my own server that lashes together compilers and build tools for whatever language I happen to be using and displays results via Bespin. The server would also use a version control system like Git seamlessly as part of the storage infrastructure. I could then connect to this server either from any modern browser meaning that I wouldn’t have to drag a machine with me to write some code. Anywhere hacking would be a boon for open source developers and students. I can also imagine a Github-like service that hosts both files and their development tools so that developers can avoid even running their own Bespin servers.

So is the age of always-available, online IDEs upon us? I think not quite yet. It’s still untested territory to a large degree. Bespin itself is coming along quite nicely and is implementing some very interesting ideas. But a lot is going to depend on how well the Bespin servers work. Headless Eclipse is fine for Java, but there needs to be similarly capable systems evolving for other languages and platforms as well. The API does a good job of keeping things minimal and implementation agnostic, but it also puts the onus on server developers to make quality systems targeting their respective platforms. I’m looking forward to some good work coming out of the Bespin and related projects in the near future. I’m even seriously considering learning some JavaScript so that I can better understand how the whole thing works. For the time being though I’ll stick to Emacs, though I’ll certainly keep an eye on the Bespin mailing list.

IDEs, education and the UNIX philosophy

I’ve never really been a big fan of IDEs, though I can appreciate how they can help speed up the Edit-Compile-Test cycle. For almost two years now I’ve been trying to use a text editor + command line strategy. However, at the moment I’m in a position where I need to start using IDEs again. In particular my software engineering class uses KDevelop and over the summer I’ll be working on a research project developing an Eclipse plugin, so I need to get familiar with Eclipse before then.

I must say that I was initially put off by the idea of having to use Kdevelop for C++ development in my software engineering class. I was really hoping to be able to use Emacs, GCC and make full time, adding to my current level of Emacs and BASH knowledge. But I have been using KDevelop for about 2 weeks now (somewhat grudgingly I must admit), there are a number of things that KDevelop makes rather smooth. Creating an SVN repository for your project and committing to it is rather well integrated with the interface. At the same time, you can’t directly checkout out a working copy and start working on it as a project: you need to check it out manually to a directory, import the directory as a project and then edit the project options to have it be version controlled. Not exactly a very smooth workflow. KDevelop’s integration with the Qmake program to automatically create Makefiles is also a time-saver. Makefiles are files which contain instructions (used by a program called make) to build large projects containing lots of files. However it is very tedious to write these Makefiles by hand and KDevelop mostly takes that trouble away. Though I’m only just starting to explore KDevelop, I think I’ll enjoy using it.

However, on a larger scale, I’m still in two minds on the use of IDEs. I still firmly believe that IDEs should not be used as primarily teaching tools, certainly not in a course like Software Engineering, which is for people who are fairly sure that they will be computer science students. I learned about Subversion before using Kdevelop. I can understand and appreciate how KDevelop helps speed things up and more importantly when things go wrong or the interface doesn’t quite work the way I want it to, I can easily drop into a shell and fix things. However I know much less about Makefiles, since I’ve never really used them. I know enough about it to understand that there is a significant amount going on under the hood which is being kept hidden from me. If something went wrong I’d be helpless to fix it. It’s not a feeling I’m comfortable with. I really wish that we had been told about Makefiles and how they work and then been told about Qmake and how the integration with KDevelop speeds things up. At this point I really hope we learn about what goes on under the hood and do so soon.

One of the reasons that I am uncomfortable with IDEs is that I’m a strong believer in the UNIX philosophy. This school of thought as applied to programs can be stated thus:

Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface.

I have some doubts about the text streams part, but I firmly believe in the first two segments. Once again coming back to education, it is important that students learn the UNIX philosophy and learn it well. They may not necessarily be writing completely separate programs for every little thing, but the need to preserve modularity in software is generally acknowledged. By learning how programming actually depends on lots of different tools each with their own functions, but with good interfaces, students can better understand how to write modular software. The IDE encourages the idea that powerful software comes in monolithic chunks. Even if the idea is modular and depends on other programs under the hood, that fact is not always obvious to the student. It is much easier to understand the power of modularity when your tools are clearly modular in nature. Consider Emacs: it is extremely modular and extremely extensible by virtue of it’s embedded Lisp interpreter. When you want to give Emacs the powers of an IDE you string together a number of Elisp packages. More importantly you are actively encouraged to write your own Elisp code to bend Emacs to your own. This flexibility is on a completely different level even when compared to modular IDEs like Eclipse.

I suppose that many of my gripes with IDEs would disappear if they really were integrated. But they’re not. I’m using a bunch of tools for my Software Engineering course: Umbrello for UML, Doxygen for code documentation extraction and Mantis for bug tracking. The only integration here is between Doxygen and KDevelop. This means that designing, implementing and then documenting a feature will mean using several different tools. Umbrello can generate code templates from my UML diagrams, but it can’t update the diagrams as I change the code. That means that when I need to write utility classes or methods, I have to put them in code and then put them in the diagrams again manually. By using an external bug tracker I need to remember to check off on the buglist when I fix something. In a truly integrated environment, the bug tracker would be part of the IDE. As a developer I could then add information to the bug report, such a link to a specific part of the code where the bug exists. Anyone looking at my code later would be able to see that there was a bug associated with that part of the code which had been fixed (or was still active). Of course, this would mean that version control would have to be really tightly integrated so that all the changes ever made could be pulled up and compared at a moment’s notice. If I need to play the juggle-the-program to do my work, I would much rather use distinct programs and tie them together with Elisp or BASH script. In such a case a common text interface would be very useful. UNIX philosophy wins again (to some extent).

Of course, I am picking on the tools I’m using and that may not be a representative sample. I’m also aware that KDevelop isn’t exactly the gold standard in IDEs. At this point some open source enthusiasts will be pulling out the do-it-yourself card: if you don’t like the state of KDevelop, write some code to fix it. An understandable argument, and normally I’m all for it. Do it yourself is a lesson well worth learning if you’re in the technology field. But in this case, I feel it is somewhat besides the point. Like I said, I’d rather just use Emacs. That’s not to say however that I won’t ever be swayed. Right now, I would willingly use an IDE if it unified the tools that I’d be using and actually sped things up.

Ultimately it comes down to the simple fact that as someone who intends to write software as a livelihood (or as part of a livelihood at any rate), I insist on using the best tools for the job. Right now that tool is Emacs + GCC (and all the supporting tools like make). If an IDE does come along that offers me the same customizability and raw power that Emacs, I would not hesitate to give it a fair chance to prove itself. This is not to say that Emacs doesn’t have some problems, but it’s better than the competition for my use. On the same note, I also wish very much that my fellow students would learn to understand what really makes a tool powerful. However considering that one of my classmates commented that he doesn’t like the terminal because of how much he has to type, I don’t think that will happen anytime soon. Education in computer science deserves a good few posts all to itself, and it has it’s own very large set of problems, but if you actually are reading this post, I think you already have enough knowledge to know when your tools don’t quite cut it. Just make sure you act on that knowledge.