4 ms·
I agree with 95% of what he says, but I'd make one change to the Unix philosophy: text files aren't the best primitive. Text files have a super low-level API (
by mrshoe 17y ago
I agree with 95% of what he says, but I'd make one change to the Unix philosophy: text files aren't the best primitive.
Text files have a super low-level API (stat, seek, read). I think the system he describes would be much more usable if he picked slightly higher-level data abstractions. I would recommend Python's built-in types: list, tuple, dict, set. Most data can be easily represented by these types and they provide a higher level API than streams (files), which means the barriers to using them are much lower.
- scottjackson 17y agoThat's probably fair. I honestly don't think we're at the point where we can abandon text files altogether, but you're right -- a lot of data could definitely be stored in slightly higher-level data structures. I still really like text files though :)
- emmett 17y agoText files are just a wire protocol. It would be nice to have a standard (similar to http) for what you send over the wire in general. Great post by the way, very thought provoking.
- silentbicycle 17y agoThe Unix idea has never been that text files are the best primitive, it's that they're the best approach until you have a solid reason to do otherwise, and you should start simple. (Unix is more pragmatic than that - "worse is better", etc.) As long as you use plain text, you can use grep, diff, various version-control systems, etc., without having to rewrite any tools for your custom format. Still, sometimes you need more elaborate formats. SQLite is one good example of a portable, open, simple format that is complementary to flat files. JSON and Lua also seem very Unix-y to me. Unix typically also uses ELF, various compiled key-value databases, etc. Unix's choice of data types was also influenced by being written for computer that had 32k of RAM. That's, what, as much as a bar of soap nowadays?