Persistent Storage: Database vs Text Files - Montana Webmaster

Persistent Storage: Database vs Text Files

Data Storage: A Case Study

My first tech job was with a company that created software to put periodicals online. Most of the people involved had been involved in the publication business, so we had domain knowledge and great contacts. Most of the technical work was the “seat of the pants” type scramble, but it was a good scramble because we cared about doing a good job and providing quality customer service.

One of the decisions that had to be made was how to store news and other content from the periodicals on the server. The technical task wasn’t just deciding storage place to dump the data; the content had to be uploaded by staff at the periodical, stored on the server, retrieved and added to web coding every time someone wanted to read a page. This was in the 1990s. This basic process is still how many websites work. The questions of methods still go back to the basics every now and then, “What is the best way to store data for websites.

In this scenario, before the database tools that we have now were available and robust, the programmers decided to use flat text files to hold news articles data. The newspaper clients would upload a text file in a specific format and software would parse it and create web pages on the fly.

Understanding the Structure of the Data

At the start, data we needed to store was rather simple. Articles had 1) a title, 2) a byline (author info), 3) the article text. As far as the folks working for the periodical saw, that was the structure. For us, it was more complicated, because our software had to add HTML code to allow formatting for the viewers on the fly when the pages were requested. That was before CSS was supported by the browsers, so it was all just plain old HTML. Besides a method of storing the data, we needed to be sure that the software to be able to tell the difference between the title, byline and text for formatting purposes.

The method decided on was to use simple line breaks. The first line would become the <h1>, the title. The second line would become the by-line, if the first word was “by”. Every line after that was a new paragraph in the article. Super simple to code. And, newspaper staff already were used to line breaks.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.