Files
Files are the simplest, most primitive persistence mechanism.
- Simply a sequential chunk of bytes stored on some permanent
medium.
- The content of a file has no inherent structure: Flat
files
- The structure is implied by the actions of whichever program is
used to access the data.
When using simple files for persistence, the executing program must
deal with all details of how to access the data in the file:
- What data is where? (e.g. sequential vs. random-access)
- What form does it have; encoding? (e.g. text/ASCII vs. binary)
- What to do when data is missing?
- What to do when the data is invalid?
Parsing is the process of interpreting the contents
of a file in terms of data structures in a program. Software tools for
parsing (C, C++): lex and yacc.
Good points
- The simplest to program.
- The basic operations (create, open, read, write) are available in
all programming languages.
- Best when the data is simple (low complexity).
- Best when only sequential searches are required.
Bad points
- Difficulties increase seriously with data complexity.
- Difficult to solve complicated search problems efficiently.
- Problems with concurrent use by independent processes.
- Updating (modifying parts) is usually very tricky.
© 2001 Per Kraulis
$Date: 2001/05/09 07:09:11 $