course mod topic first name date completed
cit-244 file i/o computing history
module learning objectives
early computer modems like the one pictured converted binary data to sound pulses and transmitted them using speaker and microphone on a regular old telephone receivers designed to be held up to a human head. image from The Wikipedia: Rama [CC BY-SA 2.0 fr], via Wikimedia Commons

File access essentials

Please study chapter 14.10 through 14.12 on file access

File I/O program specs

Design the following program to illustrate your command of file input/output principles

program objective

Venture into the land of persistence! Create a program that represents the computer history timeline in well-formed objects AND can write all relevant data in those objects to text files stored on disk. Your program should then be able to read in previously written files and reconstruct the timeline data objects.

program requirement 0: class hierarchy

Using the original file specifications for the CIT-115 timeline, create a logical class hierarchy to represent each different kind of timeline component (i.e. computer system, computer component, human interest, etc.)

Create a sketch of your class hierarchy on paper and place it next to your workstation.

program requirement 1: factory methods

Create a dedicated method to create each subtype of object. These are called factory methods. So the method would take in any necessary values for populating the Object and returns a newly instantiated object.

program requirement 2: text-based UI

Create a simple user interface such that the user can populate the member variables on the timeline component objects with a simple menu-based navigation scheme. (I.e. 1- Add a new HW feature component, 2-Add a new computer system component...).

The program should output a decently formatted (but still text-based) version of the timeline with all the timeline events in order. This should be done using a library method that can sort objects that implement the Comparable interface.

program requirement 3: write object data to a single file

Using the LIANG9 chapter 14, sections 10-12, write the data about each timeline component to a text file, with each component getting encoded on a single line. You'll want to use a PrintWriter object to accomplish this writing process.

Create documentation of how you decided to encode object data in this file. For example, separate values for individual member variables with a comma. Also, be sure to include a header row in the file that lists the order of values in the delimited-lists on rows 2+

program requirement 4: reconstruct a timeline from file data only

Write code that ingests and processes data from your very own file to reconstruct the timeline objects such that you can print your timeline out to the screen with all items in chronological order. There are a number of classes that can help with this, the familiar Scanner class can be asked to scan not the keyboard, but a File!. You can also use a FileReader or a BufferedReader for this task.

Once you read in a line, use a StringTokenizer to chop your line up into its little parts and reconstruct your Objects, member variable by member variable.