Wednesday, July 30, 2008

Lesson of the Day: Data Integrity

Often, one needs to make sure that the data of one service/application is not inappropriately saved/cached in another service/application. This ensures the integrity of the data.

A single service/application may be responsible for providing a particular type of data. This data should not be cached or saved in another application. In this way, all data of this type is solely accessed from this application/service. All applications/services requesting this data would have to always retrieve it from this single service/application. Typically, however, other applications/services may reference data within this single application with an identifier or id which can be used and passed to the single service to access the actual original data. Therefore, data the actual data would not be replicated by the other services/application.

If the actual data were to be saved/cached in another application/service in order that the original service does not have to be called and thus improve performance, data integrity cannot be ensured. The data would then inadvertently be saved in two locations. If the data needs to change, one would have to update these two locations to ensure the integrity of the data.

This is a basic notion of application design.

Therefore, one needs to be careful in caching actual data that can be accessed from another service as opposed to simply saving the reference to the data which can be used for accessing the data in the originating service/application.