June 29, 2012

Changing Times

Times change, and with them the way we do things.

Ever since I started to program, the way you save stuff to disk has followed the same script:

I’m writing a cleaned-up File abstraction for Tinderbox 6, and for the first time I realized that nowadays this doesn't make sense.

In the old days, we had to write stuff into an open file because there was no place to save things beside the file. We don’t do that any more; you make some sort of logical stream or buffer in memory and you write stuff there. You do this before you touch the file system because if for some reason you can’t write stuff – because your realize the data is invalid or inconsistent or because something is unbaked – you want to find that out before you go messing with files and disks. Nowadays, there‘s plenty of memory.

I’m not sure that our file API needs open, close, or write. Just "create a file with these contents.