views:

20

answers:

2

For a products catalogue app on iphone which approach is more efficient? Using sqllite db or directly parsing online from xml without db?

A: 

Add your products to sqllite and update only changed/newly added products to the db at every launch asynchronously.

Render your View from the data in DB.

Chaitanya
A: 

Small amounts of data can be loaded as XML directly into memory. Thus, XML would do just fine. When using a large amount of data, a database would be a better option, but it will decrease speed simply because it needs to read/write the data to storage.
With iPhone apps and other mobile phone apps, the difference between memory and storage tends to be very small. Unfortunately, for an app to understand an XML file, it must load the XML in a DOM model. This will eat up additional memory of about the size of the XML. Thus XML is not suitable for large amounts of data. (Or huge records.)
If you have up to 50 products, the balance is in favor for XML. Over 50 and you're better off with sqllite.
An added bonus of XML is that you need to explicitly save back to storage to update your changes. With databases, any updates to the data tends to be done directly. Thus, with a database you have a bit more problems undoing any errors. However, with XML your changes will be lost if your application crashes. Personally, I prefer it to only update data explicitly on my command, thus I would prefer XML. (But not for large amounts of data.)

Workshop Alex
We have more than 2500 products but those have categories and sub categoeries. Which are the categories are under 50 products. I couldn't decide which way I have to choose.
EnginBodur
Well, just look at the total data: you have 2500 products. Thus you'd need a DB, even if you only have 50 products per category. Then again, if you're willing to create 50 files (one for every category) then XML would give a speed bonus. (But maintaining 50 files instead of one... Ouch. Not good.)
Workshop Alex