One step forward two steps back

The development time frame on magic just took a hit today, not by a bug or oversight, but instead by a good idea. One of my MSN contacts (Iszak) was talking to me about how the magic framework worked, during this conversation he said something I initially though was a bit strange, that my User class was pointless. This threw me a little as the User class is central to the frameworks design and plays a big roll in almost every interaction with the system.

His point become much clearer after I read the first line of the example he gave me.

class User extends Database {

Throughout my development although User Object  had been central to the design, it had always used the Usersystem class as a middle man when interacting with the database. This meant all loading and saving users could only be done by a few relatively complex functions within the heart of the Usersystem class. The solution of creating a user as an extension of the database class had simply never occurred to me. The solution provided a much more elegant way of interacting with the database, even more flexibility with the User objects set-up and most of all for the User Class to be the sole controller of all things user.

The big downside of this is a lot of the code I’ve written is now pointless or wrong and that a great deal of rewriting and restructuring is going to be needed. Not to mention the entire way guests are handled and users are added needs to be totally rethought. In the long run though, i do think this will be worth the setback. Unfortunately in the short term, this means a lot of extra work for me. Still more unfortune than that is a HCI exam i have tommrow, and a slight need to do at least some revison for it, which all adds up to there going to be a good few days before Magic’s back where it was just an hour ago. On the bright side though, when the next version does come, not only will its internals be more sorted out, but the demo’s will be far less unsighly thanks to the kind contribution of a defualt layout by Jason Wendell.

By Carl on May 25th, 2009 in Magic