|
When wouldn't you use a database?
Databases can make information management a lot easier, but just because you
can use a database to solve a problem doesn't mean you should.
Here's an example of an application which might seem worth using a database
for, but really doesn't need one. Each time you load a web page on Anchor, you
get a random message at the top of the page. We could put these messages into
a database, and set up a system for administrators to add, delete, and modify
the messages through a web interface. But the messages are few enough (12) and
change infrequently enough (unchanged in the past month) that it is easier to
just use a server-side script to assign them to an array, and randomly choose
one element of the array to display each time someone loads one of our pages.
Another example where a completely dynamic, database-driven solution would be
inappropriate would be on Yahoo's index of web sites. It makes sense for them
to use a DBMS to manage their index of web sites, and to allow users to search
the index. But rather than use fully dynamic, database-connected pages as a
browsing interface for users, they export the information from their database
to static pages (an approach that we'll use for our Index as it grows). If they performed queries to their site database each time
users browsed their pages, the load on their machines would increase
immensely. The resources required to make multiple database queries far exceed
the resources used in serving a mostly static web page.
If you want to make and distribute a web application that might be used by
people who don't or can't run DBMSs for some reason, storing your information
in text files might be a good idea. NetForum is a web-based discussion forum
that stores messages and configuration information in plain old text files.
Because of this, the people who use the program need not take the trouble of
installing, running, and administering a DBMS. This makes NetForum easier to
install and use, though it also makes it harder for someone not familiar with
the nuts and bolts of the program to alter it.
Finally, the more complicated you make a software system, the greater the
chance that it will fail at some point. Using a DBMS as part of a web
application gives you one extra component to worry about, one more thing that
just might go wrong. If you're dealing with large sets of information and
need a standardized way of dealing with the data, a database can definitely
help. But if a system is small enough and the information is manageable
through some other means, you may want to explore other options.
Edward Piou is an Anchor producer and runs ep Productions, a development company based in the Washington, D.C. area.
|
|