Yesterday was the first day of my month long parental leave. While the main purpose of it is to gives me and the baby time for some more quality bounding, the hidden agenda is to try to finish-up that iPhone application which we had been working on a while ago ... Parental duties and paid job, have so far colluded into putting that project on the back (waaaay back) burner. Or so it looks like. Non-obstante the fact that indeed, my (precious) geeking time had been slashed ten-fold by the arrival of the Baby, I also wasted the few minutes I could saves here and there, on trying to come up with a better way to save my application data. Since we were in a rush to get the app usable by the time we needed it, I had hacked my model so that the data (in a form of 3 arrays plus some metadata) were been stored using a NSKeyedArchiver, and fetched from it when the application was launched. That naive solution had two major issues: it was keeping in memory data that were not used, and it was putting the newly entered data at risk, since a crash of the application will (and did ...) prevent its data to be written to the disk.
To store permanent data on the device, there is 3 common possibilities: flat binary file, NSKeyedArchiver and SQLLite3. To store a limited amount of data, I personally found SQL (even Lite!) to be overkill and not that practical when dealing with objects (yes, I do know about Jeff Lamarche's project and the iPhoneLite3 project), thus I have been working on my own object persistence framework, which won't be as efficient as using SQLLite for backend (well I'm not that good!) , but will serve its purpose for this app and the others to come (hopefully!). Since I'm an ex-Newton user and developer, I couldn't help but inspire myself, rather heavily, off the Newton's Soup ...
To store permanent data on the device, there is 3 common possibilities: flat binary file, NSKeyedArchiver and SQLLite3. To store a limited amount of data, I personally found SQL (even Lite!) to be overkill and not that practical when dealing with objects (yes, I do know about Jeff Lamarche's project and the iPhoneLite3 project), thus I have been working on my own object persistence framework, which won't be as efficient as using SQLLite for backend (well I'm not that good!) , but will serve its purpose for this app and the others to come (hopefully!). Since I'm an ex-Newton user and developer, I couldn't help but inspire myself, rather heavily, off the Newton's Soup ...
No comments:
Post a Comment