Lab: Quaratine Style in Java

Quarantine style in Java - Introduction

In this lab you will implement a solution of the Quarantine style in Java for the term frequency task.

(The unchanged task description is available in the Prelude of the first lab.)

The constraints of the Quaratine style (including the ⚠️ WARNING ⚠️) are the same as the ones specified in the previous lab.

The goal of this lab is to write code that follows (a clean version of) this style.

Unlike the previous lab, this one requires you to think about types. You might realize that the type checker actually helps you in verifying that your solution adheres to the style.

Use “strong types”: you should avoid circumventing the type checker. For example, avoid casts, avoid Object as a type, and avoid “raw types” (i.e., Java generics without the type parameter).

Create and Clone Your GitHub Repository

To create the repository for this lab, fork this starter repository.

Your repository now exists on the GitHub servers. If you want to work on it, you first have to “clone” it on your computer.

Implement Your Program

You can find Crista’s Python implementation of the Term Frequency task in Quarantine style in her GitHub repository.

Use the modified version of Crista’s implementation (provided again in the previous lab)as a starting point for your Java code. You can also make use of the functions’ implementations you wrote for the Pipeline lab (or the code snippets provided in the description of that lab).

Once you have the repository (a directory) on your computer, you can open it in your IDE (e.g., in VS Code). You can easily do this using the code command, passing as an argument the path to the appropriate directory:

code ~/lab-08-quarantine-java

Before you start “hacking”, please read the README (file README.md).

Then create a new Java file named TermFrequency.java.

Implement a solution to the term frequency task in Java following the Quarantine style.

Run, Test, and Debug the Program

Read the README.md and the first part of this lab to figure out how to run the program.

Test

We strongly recommend to use the test script, because it shows you whether your solution is functionally correct. For this, it compares your output with the reference output we provided. Obviously, this only works if you strictly follow the rules (e.g., don’t print out debug output), otherwise the script will tell you that you don’t produce the correct output.