Most serious applications need to persist some amount of data. This data could be transactional data, user preferences, or the current state of the application. There are many ways that we can persist data in our applications and figuring out the appropriate way to persist it can be one of the most critical decisions that an architect needs to make.
As an architect, we should separate the actual data storage from our business logic. This will allow us, in the future, to change how our data is persisted without having to change our business logic. This is called a data access layer.
It is important when designing an application, to design a good data access layer. Having a good data access layer will make our code much easier to maintain as requirements change. As an example of this, let's say that we choose to persist our data in an XML formatted file and then we embed the code to access this file in multiple parts of our code. In the future, if we decided to switch to a...