15.04.2018 Views

programming-for-dummies

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

276<br />

Using Database Files<br />

Database controls take care of the details of how to connect to a database so<br />

you can just focus on using a database file.<br />

When a program connects to a database file, that program often acts as a<br />

front-end to that database. A front-end basically wraps a friendly user interface<br />

around the database file. So rather than <strong>for</strong>ce users to figure out arcane<br />

commands to retrieve, print, edit, search, or sort through a database file, a<br />

front-end provides a simplified interface <strong>for</strong> manipulating data, as shown in<br />

Figure 8-10.<br />

Figure 8-10:<br />

Programs<br />

often act as<br />

a frontend<br />

to a<br />

database<br />

file.<br />

User<br />

Commands<br />

In<strong>for</strong>mation<br />

Front-end<br />

Commands<br />

Data<br />

Database<br />

Database files are best <strong>for</strong> storing large amounts of in<strong>for</strong>mation that you can<br />

share with other people and programs. If sharing data with other programs<br />

isn’t important, use a random-access or untyped file. The drawback is that<br />

both of these files <strong>for</strong>ce you to write additional commands to store and<br />

retrieve data. For storing small amounts of data, use a text file.<br />

Storing in<strong>for</strong>mation in a file is a crucial part of most programs, so determine<br />

what type of data you need to save and then choose the file <strong>for</strong>mat that<br />

makes the most sense <strong>for</strong> your program.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!