CS126 Design of Information Structures
Coursework Specification Term 2, 2022/23
Contents 1 Introduction 2 Submission Details 3 Guidance 4 Warwick+ 4.1 Required Software . . . . . . . . . . 4.2 Building Warwick+ . . . . . . . . . . 4.3 Running the Warwick+ Application 4.4 Running the Warwick+ Test Suite . 4.5 Warwick+ File Structure . . . . . . 4.5.1 data/ . . . . . . . . . . . . . 4.5.2 src/main/ . . . . . . . . . . . 4.5.3 src/test/ . . . . . . . . . . . 4.6 Data used for Warwick+ . . . . . . . 4.7 Key Stats . . . . . . . . . . . . . . . 4.7.1 Movies Metadata . . . . . . . 4.7.2 Credits . . . . . . . . . . . . 4.7.3 Ratings . . . . . . . . . . . . 4.7.4 Keywords . . . . . . . . . . . 5 Screenshots
1 Introduction
A developer of a new Java application has asked for your help in storing a large amount of film-data. The application is called Warwick+. The purpose of this application is to present data and fun facts about films as well as the cast and crew who worked on these films.
However, for the application to be practical all the necessary film-data needs to be stored in a clever way so that they can be accessed efficiently. Unfortunately, the developer of Warwick+ hasn’t taken CS126, so they don’t really know how to design and implement data structures. With this project, you will have the opportunity to help the developer finalise this application. This task mostly involves designing data structures and embodying them into Warwick+ so that the different functionalities of the application are efficient.
In order to help you with your task, the developer of Warwick+ has provided you with a large part of the film-data that are going to be used in the application. These are stored in 3 separate files containing: • Movies: the data about the films such as an ID number for each movie, a title, and runtime. • Credits: the data about who starred in and produced the films. • Ratings: the data about what different users thought about a film (rated out of 5 stars), and when the film was rated.
The developer has left the source code of Warwick+ for you to finalise. In this code, there are a few Java classes that remain unfinished. Specifically, these are the Movies class, the Credits class, and the Ratings class. Furthermore, the developer provided the methods-functions you need to implement for each of these classes, together with their JavaDoc specifications.
Apart from the above, the developer has also implemented the MyArrayList data structure into a 4th dataset (called Keywords) to show you where to store your data structures and how they can be incorporated into the pre-made classes.
Finally, the developer has left some instructions for you, which include how to build, run and test your code; as well as the file structure of the application (see Section 4).
Therefore, your task is to implement the functions within the Movies, Credits, and Ratings classes through the use of your own data structures.
2 Submission Details
You should submit the following in a single ZIP file by Monday 20th March @ 12 noon via Tabula: • The main directory of the application including ALL code located within it. For more information, see Section 4.5.2. • A 1500-word report discussing the data structure(s) you have implemented for the 3 classes. You are required to justify your choice of the data structure(s) you selected then explain how you implemented it/them.
The report can be structured however you see fit, but should be saved as a PDF document. References, captions, tables, figures and code listings do not count towards the word limit. The ZIP file should be uploaded to Tabula by the deadline specified. Instructions for combining all your files together into a ZIP file on the DCS system can be found by running the command man zip in the terminal of any DCS machine.
When developing your code, you are not allowed to use any data structure that is already implemented within a Java library. This includes the data structures found in the Java util package. However, you are allowed to use any Java data structure interface.
It should also be noted that submitting a solution that utilises the MyArrayList will not score marks since an example of this solution has been provided for you. To summarise, you should implement your own data structures within the Movies, Credits, and Ratings classes.
3 Guidance
Firstly, don’t panic! Have a read through the documentation provided in Section 4. This explains how to build and run the application. This can be done without writing anything, so make sure you can do that first.
Then have a look at the comments and functions found in the Movies, Credits, and Ratings classes. More information about these classes can be found in Section 4.5.2. Each function you need to implement is preceded by a comment that:
• Describes the purpose of the function. • Lists each of the parameters for the function (lines starting with @param), and what the function should return (lines starting with @return).
It is recommended to start coding the Ratings class first. This is because it is the smallest and the simplest of the 3 classes you need to implement. When you have completed a function, you can test it using the test suite described in Section 4.4. More details about the location of the code used for testing can be found in Section 4.5.3.
4 Warwick+
Warwick+ is a small Java application that pulls in data from a collection of Comma Separated Value (CSV) files. It is designed to have a lightweight user interface (UI), so that users can inspect and query the data. The application also has a testing suite connected to it to ensure all the functions work as expected. The functions called in the Warwick+ UI are the same as those called in the testing, so if the tests work, the UI will also work.
4.1
Required Software
For the Warwick+ to compile and run, Java 11 is required. If you are running Warwick+ on the DCS system, then you don’t need to worry about this as it has already been installed for you. However, if you are planning on working on your own machine, then you will need to make sure that you are using Java 11. Whilst a newer version of Java can be utilised, other parts of the application will also have to be updated and this has not been tested. As such, it is highly recommended you download and use Java 11.
4.2
Building Warwick+
To compile the code, simply run the command shown in the table below in the head directory (the one with src directory in it). This will also try and execute the tests.
4.3
Linux/DCS System
MacOS
Windows
./gradlew build
./gradlew build
./gradlew.bat build
Running the Warwick+ Application
To run the application, simply run the command shown in the table below in the head directory (the one with src directory in it). Linux/DCS System
MacOS
Windows
./gradlew run
./gradlew run
./gradlew.bat run
If the code has not been compiled, this command will also compile the code. When this is done, a window will appear with the UI for the application. The terminal will not be able to be used at this time. Instead it will print anything required from the program. To stop the application, simply close the window or press CTRL and C at the same time in the terminal. Important Note: The terminal will say that it ran up to 75%, and will stay there for the duration of the program. This is fine, and is expected. All print statements will still go to this terminal, and will appear above the loading bar. Important Note: The initial UI is dependant on the functions Credits.getStarsCastID() and Credits.getSuperStarCastID(), and will not load until these functions have returned. As such, the UI may take some time to fully load if these functions have not been implemented efficiently.
4.4
Running the Warwick+ Test Suite Linux/DCS System
MacOS
Windows
./gradlew test
./gradlew test
./gradlew.bat test
If the code has not been compiled, this command will also compile the code. When ran, this will produce the output from each test function. It will also produce a webpage of the results, which can be found in build/reports/test/test/index.html
... 4.7.4
Keywords
The following is a list all of the data stored about the keywords for a film using the given name from the CSV file, in the same order they appear in the CSV file: • id: An integer representing the film ID. The values for this directly correlates to the id field in the movies data set (see Section 4.7.1). • keywords: A JSON list that contains all the keywords relating to a given film. Each keyword is represented as a key-value pair, where the key is represented as an ID number, and the value is represented as a string. For ease, Warwick+ passes this into an array of Keyword objects.