Throughout this book, we re going to be building a CD database application to show the techniqueswe ve been learning. We start with a shell script, but pretty soon we ll do it again in C, add a database, and so on. Let s start. RequirementsSuppose we have an extensive CD collection. To make our lives easier, we re going to design and imple- ment a program for managing CDs. An electronic catalogue seems an ideal project to implement as about programming Linux. We want, at least initially, to store some basic information about each CD, such as the label, type ofmusic, and artist or composer. We would also like to store some simple track information. We want to be able to search on any of the per CD items, but not on any of the track details. To make the miniapplication complete, we would also like to be able to enter, update, and delete any information from within the application. DesignThe three requirements updating, searching, and displaying the data suggest that a simple menu adequate. All the data we need to store is textual and, assuming our CD collection isn t too big, no need for a complex database, so some simple text files will do. Storing information in text keep our application simple, and if our requirements change, it s almost always easier to manipu- late a text file than any other sort of file. As a last resort, we could even use an editor to manually enterand delete data, rather than write a program to do it. We need to make an important design decision about our data storage: Will a single file suffice and, what format should it have? Most of the information we expect to store occurs only once per CD (we llskip lightly over the fact that some CDs contain the work of many composers or artists), except trackinformation. Just about all CDs have more than one track. Should we fix a limit on the number of tracks we can store per CD? That seems rather an arbitrary restriction, so let s reject that idea right away! If we allow a flexible number of tracks, we have three options: .Use a single file, with one line for the title type information and then nlines for the trackinformation for that CD. .Put all the information for each CD on a single line, allowing the line to continue until no moretrack information needs to be stored. .Separate the title information from the track information and use a different file for each. Only the third option allows us to easily fix the format of the files, which we ll need to do if we everwish to convert our database into a relational form (more on this in Chapter 7), so that s the option