Page 379 - Beginning Programming with Pyth - John Paul Mueller
P. 379

looks similar to the output in Figure 16-1, even though the data was written to disk and read back in. This is how applications that read and write data are supposed to work. The data should appear the same after you read it in as it did when you wrote it out to disk. Otherwise, the application is a failure because it has modified the data.
FIGURE 16-4: The application input after it has been processed. Updating File Content
Some developers treat updating a file as something complex. It can be complex if you view it as a single task. However, updates actually consist of three activities:
1. Readthefilecontentintomemory.
2. Modifythein-memorypresentationofthedata.
3. Writetheresultingcontenttopermanentstorage.
In most applications, you can further break down the second step of modifying the in-memory presentation of the data. An application can provide some or all of these features as part of the modification process:
Provide an onscreen presentation of the data. Allow additions to the data list.
Allow deletions from the data list.
Make changes to existing data, which can actually be implemented by adding a new record with the changed data and deleting the old record.
   
























































































   377   378   379   380   381