Friday, June 30, 2006

Retreading old ground

I've made the decision to go back and redo the database code. Since writing it in the first place I've got, well, a little better at coding. At the moment, the main problem is that in order to access, say, the date of birth of a player, I've got to read in all of that player's data into a Player type, and then have a gander at his birthday.

Hey, it made sense at the time - by reading and writing whole records, I saved myself a few headaches. But it came at a price - every time I wanted to change the database I had to make numerous changes to the game's code as well, and over the last week it all came to a head when I realised I was putting off work on the next issue because it involved this utterly soul destroying task.

I had had enough. I decided that I needed a way of telling the database system that I just want to look at the "Year Founded" field in "Club" without also getting the youth coach's weekly wage. It does mean a few extra problems need solved but I'm up to that task now. The new system when implemented ought to save me plenty of time, and it also keeps the game easily expandable.

The larger problem with this decision is that the Data Editor pretty much needs rewritten as it is based almost entirely on the old database code. Arse. But it can't be helped, it's going to have to be done.

Keeping this database clean is useful because it means I can create the basic game and then spend most of my time adding leagues and making improvements, rather than fighting with hideous code and ending up churning out crap.

Nobody wants crap.

Not even flies. But flies can't be choosers. Or I shall kill them.

No comments: