K.Mandla's blog of Linux experiences

That split-second realization

It happened to me again yesterday. That moment everyone talks about, when a GUI program is suddenly inconvenient and obtrusive, and you realize that the console alternative is just plain faster and easier than clicking buttons and waiting for an interface to accomplish the same task.

This time it was Leafpad, a program I otherwise hold in rather high regard, just for the direct-line simplicity of it and for its ability to avoid over-complication in becoming something it isn’t — like a code editor, or a word processor. Leafpad is just a text editor, and on any other day it would be what I pointed to if you asked me for a GUI editor I liked.

But this time I needed to do a search-and-replace for a series of oddball characters in a text file, and in the half-second it took to open Leafpad, I realized that I would still have to point-and-click to find the file and open it, then open the search-and-replace dialog, and then type in the appropriate strings and click the radio buttons to get the search behavior I wanted, then click to execute the search, then again to finally save it.

And I realized the same thing could be done in vim in about a tenth of the time, with a tenth of the “clicks” involved.

It’s not a particularly good or particularly fair example, since the two programs are bit distant in terms of potential too. Some of the things I mentioned that Leafpad doesn’t do are workaday affairs in vim, so the comparison becomes a kind of patronizing pat on the head for Leafpad.

It’s also a bit backward when the Leafpad package, according to ftp.archlinux.org, takes up 92Kb, while vim is a monstrous 5441Kb. Of course, you could argue in reply that Leafpad won’t run without the software morass called Xorg, which outweighs vim on a proportional scale.

My point here is not size of the binary or available features though. Each program — in this pair and in any other comparison — has pros and cons, and even if I could prove mathematically that one was superior to the other, you’d still be free to use whichever one you liked.

Just be aware that there may come a time — even if it only lasts a split second, like it did for me yesterday — when you’ll realize that you could do the same thing easier, faster and probably without incurring as much in required software, by relying on a console-based program instead of a GUI one. Maybe that split second will pass by without much more thought, or maybe that will trigger some other thoughts as well.

There are barebones flavours of vi available. If you wanted to cut it further, vi is available within busybox too! I myself use the vi provided by busybox, and it more than satisfies my requirements. Mind you, I’m not a programmer and I don’t have very complicated requirements.

Whether the memory/disk footprint of Xorg should be counted against Leafpad depends on whether or not you use any other X apps. I have a hard time imagining someone firing up a GUI environment solely to use a text editor. The more common scenario is that the GUI is already running and serving several other applications. The “cost” of the GUI is distributed across that entire set of applications, and you have to look at the entire set to decide if it’s worth it.

Similarly, the console version of vim uses ncurses and various system libraries, but we typically don’t consider them part of its footprint, because other programs are also using them.

That said, many so-called shared libraries aren’t really shared and should be counted against the programs that installed them.