Thursday, November 24, 2005

As above, so below. Or not.

Something that occurred to me a while ago: I use Gentoo, and that means all my software is compiled from source. When you compile something you have the option of compiling in specific parts of the code for specific functionality.

You might want to compile in support for Esound rather than Alsa or Arts, for instance. You might want to compile the Links text-browser without X11 support. You may want to compile mplayer with support for Windows codecs. And so on.

It's just like compiling the kernel itself: You work out what you want it to do, and compile in support for the things you want, without support for things you don't want.

But it's not like that. Because the kernel has another option: It has loadable modules. This means you can code in support for almost anything, but without having it make the kernel any bigger, because it's loaded separately, and only when needed.

Linux is often touted, even today, as running on software with minimal requirements. Imagine if every feature of every bit of software could be chosen at compile time, as either "in", "out", or "module"

Let's take Firefox as our example.

I never use the "Back, Forward, Stop, Refresh" collection of buttons: I use keyboard shortcuts and/or mouse gestures. These buttons are worthless to me. I'd like to compile them out.

I don't use Live Bookmarks much any more: I have an RSS aggregator on my web page, it works better as it can give me article summaries instead of just the titles. But occasionally, I do want the live bookmarks for some reason. I'd like Live Bookmarks to be a module: Not loaded when Firefox starts, only loaded into memory when I actually click on the Live Bookmarks subfolder.

Some people might not want any bookmarks at all: They might think del.icio.us is all they need.

Some people don't use Firefox extensions at all. But they still have all the functionality for it, none of which they're using. Same goes for themes and Plugins. And so on.

Linux code is almost invariably modular. I gather Xorg is being re-written to be even more modular to make it easier to maintain and upgrade the code.

What if that modular nature were expanded even more? What if every piece of software were as configurable as the kernel? You could still use "Yes, chuck in the kitchen sink as well" binaries for people who don't care. But for people who do care, being able to compile in only the features that are needed could make Linux as configurable as it's possible to get.

It's not so it could run on old hardware: That's all well and good, but doesn't really benefit many people.

But rather, so that it could run on very modern hardware: PDAs and other small devices that are cutting-edge but not very powerful. If you could make Linux software as lean as possible, you could really increase the number of Linux apps. that these devices can run, and the speed at which they can run them.

Especially if you could make it so that it didn't interfere with existing ways of installing software, but just added a new one, so you could:

Download a compiled binary with all the typical options built-in

Compile from source with all the current typical options

Call up a "menuconfig"-style menu that allows you to enable, disable, or modularise every possible feature of the software.

I reckon you could really boost Linux' appeal in less-powerful devices by doing this. To say nothing of the benefits of having highly modular code.

Just a thought. . .

1 Comments:

hari said...

I agree about modular design. However the difficulty is not so much in maintaining it but thinking in modular terms.

I know that modular and OO programming requires a totally different way of thinking. And even OO programming need not imply modular code.

It requires extremely careful design to make anything "modular." I guess that many developers skip the "design" part and end up with a big messy, monolithic program rather than a modular, sleek scalable one.

4:04 PM  

Post a Comment

<< Home