开发者

Is it bad practice to store a relatively large amount of non persistent data in lists?

I'm working on an iPhone app in which I manage some kind of "agendas". The app needs to be authenticated on a server to work ( = no offline mode ) so I don't need any kind of persistence on the iPhone.

开发者_JAVA百科

Is it bad practice if, once I retrieved datas for the agendas from the servers ( around 10-50 lists of ~30 days ) I store them into custom c# objects containing lists of other objects (basicly months containing days) instead of setting up a database or using XML ? I need to be able to edit and search through them fairly easily ( I'm using LINQ with success in my P.O.C. at the moment )

Thanks in advance, regards,

C.Hamel


No, it is no bad practice. You don't need to persist this data, so no need for a local DB or XML. You need to load the data into memory anyway to search it...


As long as there is no requirement to persist data it is fine to store it in memory.
By the way, it is pretty straight forward and quick to serialize data in iPhone ,if you prefer (in case of low memory).
Serialization vs. Archiving? my answer with details about archiving and serializing. Hope that helps, if you want to persist(serialize) data.


I am not too sure how iPhone allocates memory to its processes, this may also varies from model to model. You might face some painful troubles, when the device wouldn't allow you to allocate sufficient amount of memory for all your data.

Even though keeping data in memory is super fast, I will suggest persisting it partly. You can get away with a limited cache of the most recently accessed data and persist everything else. It is more reliable and safe, maybe a little bit slower so you need to find a balance.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜