-=|Big_Bang|=-
Main Menu
Blog
About Me
Projects
Resume
Book Reviews
Gallery
GPG
Search
Contact
Latest Posts
I recommend
Open Source Spot
Open Peru Planet
Debian GNU/LINUX
Blogs
Mod Lost
Mapix
Veli64
Železničná Stanica
Routerman
Dennis Blog
Adeene
Albert's Blog
Archives
Syndicate
Tip for some “Teachers”: Flat files….
Written by Martin Kenneth Lopez   
This time we will write about some issues about programming, special for c, c++, in this case usually you can use flat files for save data from your programs, this is ok, nobody will say that is a bad programming technique, but what’s wrong is that some teachers are trying to say to their students that this is ok and that this thing works fine.. or that is best way to handle data when you are programming.

Before we have Database’s the only way the handle data was thru files… in that time, the only way was using the files, even now the files handling isn’t wrong… because is really useful when you want to save some data, for that you wont need a database…


Here you have some Problems with Using Flat Files

There are a number of problems in working with flat files:

 
 
  • When a file gets large, it can be very slow to work with.
  • Searching for a particular record or group of records in a flat file is difficult. If the records are in order, you can use some kind of binary search in conjunction with a fixed-width record to search on a key field. If you want to find patterns of infor¬mation (for example, you want to find all the customers who live in Smalltown), you would have to read in each record and check it individually.
  • Dealing with concurrent access can become problematic.  You can lock files, but this can cause a race condition. It can also cause a bottleneck; a large group of users may be waiting for the file to be unlocked before they can place their order.
  • All the file processing we have seen so far deals with a file using sequential pro¬cessing—that is, we start from the start of the file and read through to the end. If we want to insert records into or delete records from the middle of the file (ran¬dom access), this can be difficult—you end up reading the whole file into memo¬ry, making the changes, and writing the whole file out again. With a large data file, this becomes a significant overhead.
  • Beyond the limits offered by file permissions, there is no easy way of enforcing dif¬ferent levels of access to data.

One more time, what I’m trying to say is that use flat files isn’t wrong is just we have to use the write tool for the right job, for example is we have to build a software that will handle many records we wont use flat files, we’ll have to use a database….  But if we want to store a few records or a couple of numbers…. You can use files or if you want a database….

Now, why I’m saying all this?? Well basically because when you are taking courses of programming at university and you see on your exam sometime something like… you have “N” flat files and you have to perform some search for a report using only flat files.. it’s like… this isn’t write… using databases this could be solve in minute’s but using files first, is going to take a lot of time, second wont be the best and the right solution, third there are many other ways to test our ability and skills.

May the source be with you.

Comments
Add New
Write comment
Name:
Email:
 
Title:
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
Please input the anti-spam code that you can read in the image.

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

Last Updated ( Thursday, 28 February 2008 )
 
< Prev

© 2006 -=|Big_Bang|=-