I’m working on a simple application for a game in Java that allows a user to record whether they have collected a given item and how much experience it contains. This will work for multiple item types (weapons, armor) and each will have its own tab with a list of all items that qualify under it. Making changes as new types are added is not such a big deal (if a clothing slot is added, for instance), but new items are added to the game all the time in biweekly patches, and I’m not sure what the traditional/customary way to make sure the application is user-extensible without requiring me to would be.
Whether that would be adding a configuration menu that allows users to add news items (new rows to the local SQLite database) or a text file with something similar, but I’m certain there’s a well-accepted way to do this that I’m not aware of. I’m new to databases and ignorant of the solution, so what’s the professional/futureproof way to do this?
3
Three points.
-
You need your code to be stable. Occasionally you will have to change it to add new item types or features, but it will always have to be backward compatible.
-
So new items, and as far as possible new types of items will be added in data, not code. It matters not a bit whether you use a database, text file, XML, JSON or binary blobs, because…
-
You need to provide a user interface for updating the data. When new things have to be added, the user goes to a form or screen or data entry device that allows new stuff to be added and checked for validity. That is how it’s done (or should be done).
-
When you do need to add new functionality, as well as backward compatibility you need to upgrade/migrate existing databases. Users don’t like to lose what their work just for your convenience.
3