- Flat files (XML, JSON, etc)
- Databases (SQL, NoSQL, etc)
- RAM
Flat files are useful mainly when you just can't have a database, for some reason. They're also useful when dealing with documents.
SQL databases (aka Relational Databases) are useful for data that has many parts that are related to each other.
NoSQL databases are useful for document storage, with minimal relationships. They also tend to be easily horizontally scalable.
When I started working on the MUD, I was pretty sure I was going to use CouchDB or another NoSQL database for a few reasons:
- Horizontal scaling
- MUD accounts could be easily stored as documents.
On the other hand, a NoSQL database could store the user's account and everything attached to it as 1 big record. Each area in the world could be another, etc. It would simplify the data access quite a bit.
But in the end, I decided I didn't want to limit it to any of these. I'll be writing a system that will store the data in any of the above methods simply by setting that information in the configuration files. It should even be possible to create conversion tools that quickly convert from 1 format to another. This would make backups or migrations quite easy.
And there's one more thing it makes easy: Testing. I will be creating a mock data store that can be used to feed any data into the system at will. That'll make unit tests quite a bit easier and faster.
No comments:
Post a Comment