Hi, I've restarted writing my Settings class for over a dozen times now; I never like the result. The responsibilities for the Settings class are very easy: - Be able to set (new/existing) settings - Be able to get settings - Has to sync with an xml file
I'm using it in an AIR app and I'm loading the data synchronously, so no events are involved (thank god for that, although I'm curious how to handle this if the xml file is loaded asynchronous) . What I'm having trouble with, is finding a method that's easy to use and will notify me of typo's. Hence, something like 'Settings.getInstance().g("mySettingName")' won't be possible. I bet you're thinking: "you can't have it both ways! Either you make it dynamic (/Proxy class) or you predefine every setting you will need in some sort of static var and end up with Settings.getInstance().g(Settings.MY_SETTINGS_NAME). Well, I'm hoping that there's a way to have the best of both worlds. Since the class needs to be dynamic, compile-time errors probably won't be possible, but runtime errors surely should be? Are there any popular classes out there, or is there a certain design pattern / architectural pattern that I can use? I've already tried a bunch of implementations that I wrote myself, but I'm curious what the Flash community has come up with so far. Thanks for reading and if something's not clear, please let me know and I'll elaborate some more. Cheers!