you're reading...

On Second Thought…

The other day[^] I mentioned how I was considering using a database to store all of the data used by the game.

I’m thinking that isn’t such a great idea now, for the primary reason that it makes updates very hard to do, say if you want to add two more affects you not only need to add the fields to the code, but you have to modify the database. My goal is to make it so that you don’t have to modify any datafiles when you add/remove minor details.

An advantage of using an XML File is that the XML Serializer will take care of all the details, so if an element is missing then it will be filled in with the default value. I don’t yet know how it will handle an Enum member missing or a field missing.

edited at 2003-05-05 08:41:34
I just did some testing and there are no problems if an element in the XML document exists that doesn’t match up with an appropriate property in the class.

There is a problem if you remove or rename a member in an enum that is present within the XML document, because the member is referenced by name.

C# does allow you to have two members in an enum share the same value, but there is a slight problem with just adding your new member in addition to the older one. You have no idea which of the two values was used to set the flag. So you wind up with another unworkable solution.

There is a faint light at the end of the tunnel, because the XML Serializer reacts well to new data members being added to a class you can add a new set of flags. The downside of course is that you need to add code to use that set of flags, but you had to modify those bits of code anyway.


About James

I am a Senior Developer/Consultant for InfoPlanIT, LLC. I previously spent over 7 years as a Product Manager for what eventually became ComponentOne, a division of GrapeCity. While there, I helped to create ActiveReports 7, GrapeCity ActiveAnalysis, and Data Dynamics Reports.


No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


%d bloggers like this: