Homework III variant: HW2 continuation

Requirements

For this task, all requirements for homework 2 apply for both the documentation and the code. In addition, the following has to be done:

  • Logs must include accurate timestamps
  • Must use CSV (comma separated values). In addition, the field itself must be able to allow for the same symbol as is the separator.
  • You must use a doubly linked list when reading the data file, which only contains a primary key (e.g. movies, books, phones, accounts), to memory. You can change this to use any type of trees, if you feel this will improve your program. In this case the benefit must be documented.
  • Items for the second data file can be read to the data structure of your choosing that makes sense for the task.  It is required that PK-FK relation will be handled by pointers. This means that from any item in the first data structure, you must be able to go directly to the related items in the second data structure by dereferencing a pointer. The association must be done while reading in the data from the files or right after it.
    • You can combine multiple accessing methods if this makes sense for your task.
    • Some ideas:
      • A pointer to the singly or doubly linked list of related items
      • A skip list
      • A dynamic array of pointers which reference the items. It might be in a form of a hash table for speed.
      • Some variation of trees
  • You must be able to delete any entry from either data structure through the program
    • The removal must immediately take place in the program while it’s still running.
    • The removed row(s) must also be removed from the file(s), so the next time the program runs, they will not exist any more. This can be done either immediately when deleting or after the user decides to exit the program.
    • Removal must be done by their respective unique IDs.
    • Data integrity must be enforced.
      This means that you cannot delete an item from the primary file which still has PK-FK relations to the second file. Once all items have been deleted which have a PK-FK relationship, then the item from the main data structure can be deleted
      E.g. If a movie has ratings, the movie cannot be deleted before all of the ratings for that movie have been deleted.
  • You must be able to add any entry to either file through the program.
    • The addition must immediately take place in the program while it’s still running
    • The added row(s) must also be added to the file(s), so the next time the program runs, they will also be read in. This can be done either immediately when adding or after the user decides to exit the program.
    • Data integrity must be enforced (E.g. you cannot add ratings to a movie that doesn’t exist yet).
    • All fields must be checked to match the format.
    • The generated ID value must be unique (typically a sequential value). Only in the case of using well-known values such as ISBN codes for books, Estonian ID codes for people, international IBAN numbers for bank accounts etc. can such a number be entered manually while adding entries.
  • All updates (both addition, removing and changing) must be written to the data files. If the program is relaunched, it must be able to successfully read in the modified data files.
  • The new functionality must be added to the menu.

 

Documentation

  • Everything that was for Homework 2 must be expanded to cover the added functionality
  • You must add a visualization of the data structure that will be formed. It must show how the PK-FK relations are also handled.

Deadlines

The task must be submitted by 08.01.2020

Send all of the necessary files to: risto.heinsar [ät] ttu.ee

A defense might be required.