3 ms·
I would agree with everything except 2). Human-readable files are ok if you're building a small program mostly by yourself, but in larger programs, on a team wi
by jolux 4y ago
I would agree with everything except 2). Human-readable files are ok if you're building a small program mostly by yourself, but in larger programs, on a team with other people, it becomes a mess very quickly. And if you need to enforce data integrity, forget about it. You're going to find yourself replicating what a DB gives you for free in your own code, except you're going to get it wrong.
So: Hacker News, tiny team (one person?), very simple application, doesn't change. An accounting system: rather complex, frequently changing requirements, often developed by larger teams, needs to be accessible to non-developers, has data integrity requirements. You've really got no choice except SQL.
You should definitely consider every application's needs individually, but there's a line for everything where it makes more sense to use a DB, and not understanding where the line is will bring you a lot of pain. As for longevity: the SQLite3 format has been around since 2004 and is utterly ubiquitous. I think it's pretty safe.
- TekMol 4y agoSmall teams? Here is to small teams! Vim, Git, Hacker News, Photopea - many of my favorite, most used programs are created by a team of one! Larger programs? Look at Linux and its "everything is a file" philosophy. Linux is one of the largest codebases out there. SQLite will be around for a while, but not as long as text files. Who knows how long you can easily access present day sqlite files without fiddling with SQLite version numbers. And the format does not offer the easy access to the data that text files do. I'm not saying nobody should ever use a DB. But files are often the superior approach.
- avgcorrection 4y agoTorvalds created the initial version of Git. It was eventually handed over to Hamano and has been developed by many different people since then.
- jolux 4y ago> Vim, Git, Hacker News, Photopea - many of my favorite, most used programs are created by a team of one! Git is actively maintained by a number of people: https://github.com/git/git/graphs/contributors https://github.com/git/git/graphs/contributors Most commercial software is developed by teams. > Larger programs? Look at Linux and its "everything is a file" philosophy. Linux is one of the largest codebases out there. "Everything is a file" is an abstraction that Unix presents to the user. It's certainly not the case that that's how everything works underneath — the file system itself isn't a file, for example. > I'm not saying nobody should ever use a DB. But files are often the superior approach. And I'm not saying nobody should ever use text files. But a database is often the superior approach.
- TekMol 4y ago"The file system itself isn't a file" is not a valid argument. Otherwise I would counter "Even SQLite stores its data in files".
- gonzo41 4y agoI agree, I would only add that you should implement the SQL db as matter of factly as possible. If you can store data in files, figure out a way to make a dead simple set of tables, maybe even just one. Nothing fancy. Just wait till you hit real limits before thinking about all the high availability, dtributed db stuff.