Reference no: EM13690
Prepare WorldDataApp project. It implements the NameIndex portion, including:
• creating it (implemented as a Binary Search Tree (BST)) in SetupProgram, and
• searching, viewing and updating it in UserApp program.
A third program, PrettyPrintUtility, displays the backup index file so the developer (and grader) can easily view the file in a nicely-aligned printout. NameIndex is created as an internal data structure - so in order to "move it" from one program execution to another (i.e., from SetupProgram to UserApp, and from UserApp today to UserApp tomorrow), it is saved and re-loaded to/from a backup file.
So there are 3 physically separate programs, all within a SINGLE Java/C# project:
1. SetupProgram - creates the internal NameIndex based on data in the RawData file - and saves it to the Backup file
2. UserApp - loads the NameIndex from the Backup file, then processes the transactions in Trans file, sending output to the Log file, then saves the index to the Backup file
3. PrettyPrintUtility - reads/prints the Backup file to the Log file
There are 4 data files used in the project:
1. RawDataTester.csv (input to SetupProgram - I'll provide this file)
2. NameIndexBackup.txt (output from SetupProgram, input/output for UserApp and input to PrettyPrintUtility)
3. Log.txt (all 3 programs output to this file)
4. TransData.txt (input to UserApp - I'll provide this file)
Batch processing (vs. interactive processing) is used to facilitate testing and the capture of the programs' executions for submission for grading. That is, all 3 programs write to the Log file, and user transaction requests to UserApp come from the TransData file - rather than the console or a Windows or Web form.
Object Oriented Programming (OOP paradigm) must be used for SetupProgram and UserApp programs. But since it's just a quickie developer-utility program, PrettyPrintUtility just uses the traditional Procedural Paradigm (PP) approach.
So there are 3 classes (besides the 3 main programs):
1. RawData handles all file/record/field handling for the RawData file. It's only used by SetupProgram.
2. NameIndex handles everything to do with the internal name index and its backup file.
This class is used by both SetupProgram and UserApp.
3. UserInterface handles everything to do with batch processing including anything to do with the Log file and the TransData file. This class is used by both SetupProgram (for Logging) and UserApp (for getting TransData and for Logging).
A program is a physically separate chunk of code in its own .java (or .cs) file that contains its own main (or Main) method as the execution starting point. It is independently compile-able and independently executable.
So SetupProgram, UserApp and PrettyPrintUtility can each be run individually by the developer completely on their own. The programs must, of course, be run in the correct order - i.e., SetupProgram must be run before UserApp or PrettyPrintUtility.
OOP - Information hiding
The 3 class NAMES and the PUBLIC METHODS each describe WHAT the object is and its functionality to the "outside world", WITHOUT specifying HOW the underlying storage or interaction will be implemented. The code in the 2 actual programs which use the 3 classes are NOT at all aware of:
WHERE the RawData field values come from (A data file? Interactive users? A database? A bar-code scanner?) nor HOW it was derived (Any transformations? Record-splitting into fields? Field editing after reading from text-boxes? Floats changed to integers? Metric changed to imperial measures? Field-values calculated or read-in from storage?)
HOW the NameIndex data is stored/accessed (a BST? An ordered list? A hash table?) nor whether it's an internal or external structure or even an actual database or the cloud
HOW the UserInterface is implemented (Batch processing? Interactive using the Console? A Windows or Web front end?)
This makes OOP programs easy to change since all code changes are done within the class, with no changes to the main program code (e.g., batch input/output can be changed to a web app by altering the code in UserInterface - NameIndex could be changed to use an external HashFile rather than an internal BST - RawData could be read from a database rather than a data file).