Death to filesystems
After writing about The Real Web OS, I was happy to see that Google is getting a lot right with Chrome OS. Naturally, it is easy to focus on what they're getting wrong, but that's another post for another day.
I am absolutely thrilled to see one long-standing feature of desktop operating systems dropped from Chrome OS: the filesystem. From the user's perspective, I see no trace of a hierarchical file system. This is great news for those of us who organize everything in our lives horizontally. We've witnessed an increasing prevalence of fast and effective desktop search in recent years, yet users are still expected to manage a tree of folders and files. That's a vestigial wart that needs to be removed.
Apple's apps generally provide a layer of abstraction on top of the filesystem, so that users don't interact directly with it. You interact with your music via iTunes; iPhoto manages your photos. They can't trust third party apps to do the same, however, so they have the catch-all Documents directory. In fact, they can't even trust themselves. Apparently the iWork team doesn't talk to the iLife team much; iWork still uses the old school model: browse the filesystem to open a file and pick a folder and a name to save a file. If they're clutching to old patterns in the name of easing the switch from Office, they are making a mistake. The best way to encourage switching is to build a new and better product, not emulate old ones. It's always better to usher in the future than cleave to the past. The iPhone is the first popular computing platform to eschew the filesystem, and, if the rumors are true, Apple's tablet will be the next; that's the future.
John Siracusa's excellent review of Mac OS X Snow Leopard contains a section about filesystem APIs. He points out some of the pitfalls and gotchas:
Mac OS X has historically supported many different ways of referring to files on disk from within an application. Plain-old paths (e.g., /Users/john/Documents/myfile) are supported at the lowest levels of the operating system. They're simple, predictable, but perhaps not such a great idea to use as the only way an application tracks files. Consider what happens if an application opens a file based on a path string, then the user moves that file somewhere else while it's still being edited. When the application is instructed to save the file, if it only has the file path to work with, it will end up creating a new file in the old location, which is almost certainly not what the user wanted.
He proceeds to discuss the various file access methods and file metadata options available to application developers. Siracusa also wrote an entire article about metadata madness. It seems simply attaching a few pieces of metadata to a file is a complicated task these days. As a programmer, I couldn't help but think that users aren't the only ones massively underserved by filesystems; we too are hampered by our only interface to persistent data storage.
John Gruber wrote a wonderful article not long ago about some of the pitfalls of filesystems. His primary example is the requirement to name a file before you can save any data to disk. He encourages application developers to solve this problem for users, but I think the issue cuts deeper than the application, right to the OS itself. After all, the application would just have to choose a name for the file if the user isn't expected to do so. Some data just can't be contained by a nice little box with an appropriate label. If we're going to provide users with a better interface to their data, why not give developers one as well?
As my college roommate once said, developers need to persist data objects that have an API other than just stat, open, seek, read, write, and close. I realize that the Unix philosophy is "everything is a file" -- which really means "everything is a stream" -- but in my applications I very rarely choose to use streams except to satisfy Unix I/O APIs. Many years immersed in Python have taught me that a few primitive types can represent most data: int, string, list, dict. I wholeheartedly agree with Scott Jackson that everything should have an API, but I don't agree that we should embrace the part of the Unix philosophy which states "Store data in flat text files." I suppose we should embrace it so long as our operating system gives us no choice, but isn't it time for modern operating systems to move on? Wouldn't it be much easier to share data between applications (which is, after all, the point of giving everything an API) if the data were just stored in sensible data structures? Instead of "my application generates a file of tab-separated columns of floating point numbers encoded as ASCII which can be parsed using regular expressions" you could say "my application builds a list of tuples; no parsing necessary". Instead of using YAML for configuration, which your application parses into dicts and lists, you could just use dicts and lists directly.
There is a ton of innovation in the database space these days. These projects stuff all of their data into a small handful of on-disk streams. They have to use the lowest common denominator API, provided by the operating system, to seek around within the stream and read and write data. It's about time for operating systems to make higher-level APIs like these first class citizens. Filesystems are no good for users and they're no good for developers. I'm starting to see the beginning of their demise, and I say good riddance.
We highly recommend
subscribing to this blog
and
following us on Twitter
Do you instant message your coworkers? Try ShopTalk instead. It's better.