This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I've got the following case. Application displays data that comes from an external system and utilizes WS in order to retrieve it. Data includes list of categories or information regarding each product. Of course performance is important.
What would be the best approach to design it? As for now I see two options:
1) Assume that volume of data is low so it could be retrieved each time when user request it (via WS)
2) Assume that volume of data is high, we decide to synchronize data between an external system and application DB (make copy of it)
I'm afraid that the 2nd option may introduce stale data since we will not be able to synchronize it so often (let's say once a day seems reasonable)
Keeping a local copy of the database will add complexity & overhead. You will have to have a mechanism to synchronize it, given that it is a external system it might not be simple. How do you transfer, how often, additional manageability issues will also arise.
If you are concerned about performance & are sure that the data is not volatile, you could cache it before you make web service call. Basically before making web service call check if data is available in cache, if it is not available in cache retrieve it & also update cache. You can also add a mechanism to invalidate data which is older than pre-configured value to address concerns about stale data. Actually if you use a third party cache provider, these type of cache invalidation features are inbuilt .