Oregon State University Black Lives Matter Database of Resources Discussion
Black Lives Matter DatabaseIn 2020, in the wake of the death of George Floyd and Breyona Taylor, and in response to so many other black deaths at the hands of police, people began to organize protests all over the country (and indeed, all over the world). Karen was a student at UWB during this time, and she watched the protests on the internet, and she read her friends’ posts about the protests on social media. To be honest, she had never really spent much time thinking about these things. She had thought of herself as “not political”. But now, she began to feel some embarrassment about that. She began to realize that this “not political” stance just allowed her to remain ignorant and passive about things that were actually really really important, and it was just an excuse to stand by and do nothing. So she resolved to educate herself about the Black Lives Matter movement and all the connected issues so that she could then take a more active role in trying to make the world a better place for her fellow citizens -- and especially for black and indigenous people and people of color. She began reading books, looking up different organizations on the internet, and watching movies. As she did, she thought it might be nice to compile these different resources she was finding into some easy-to-access database so that other people who wanted to educate themselves could more easily find them.Karen was also a student in CSS 143, and so she decided to put her Java skills to use by building a database of these resources as a part of her project. She called it BLMDB (Black Lives Matter Database). The BLMDB class she built was pretty cool. She called each resource a ‘record’, and there were three different kinds of records: Movies, Books, and Online sources. Her BLMDB could display all the records, or just some of them. It could sort them. You could even choose different criteria to sort them by. It could even sort them based on multiple criteria, like first by year, then by name. You could import records from a text file into the database, or you could manually enter records. You could export the records back to a text file.Your instructor for CSS 143 paired you with Karen to work on your CSS 143 project together and you were excited (and a little bit guilty) because she had already done almost all the work creating this BLMDB, and it was basically done. But then disaster struck. First, Karen’s dog jumped up and tried to eat her laptop. (It’s the modern equivalent of “The dog ate my homework”.) The laptop fell off the table and the hard drive was damaged. Sadly, she hadn’t saved her work in the cloud. (What was she THINKING?) When she restarted it, a bunch of the files were missing, and some of the files that were there were partially erased. Many of the methods in some of the classes she built only had the Javadoc but not the method. It was a mess. And then, to make matters worse, Karen got really sick and had to go to the hospital. She sent you all the java files she had, and now it’s all up to you to restore the project to its former glory. (I suppose it’s only fair since she did all the work up to this point.) Don't erase anything that she has (except maybe the comments like "//[OH NO THIS GOT ERASED!]" ). Just add back the missing parts. Luckily, Karen practiced really good coding style and always wrote good comments (especially Javadoc comments), and that is going to be really helpful for you in figuring out what you need to reconstruct. Just make sure you uphold her high standards for good coding style. Right before Karen went into the hospital, she also asked you one more favor. She was compiling the list of resources for people to learn about racism and race-related issues, and most of what she had found so far is there in a text file. But she felt like the list of resources could be longer. So she asked you if you could do a little research and find at least one more of each of the three kinds of records (a movie, a book, an online source like an article or organization) that you could add to the text file. If you want to find more than one of each, that would be even better. But at least one of each.Here’s what we know about the project so far. (After this, you’ll just have to go through the files and try to figure it out yourself. For example, if you see a method being called, but that method doesn’t exist, you better go create that method.)BLMDB.java. This is the primary class, and it has a main method that is the driver for the whole thing. Luckily, this class seems to be mostly intact. Inside of it, it has an instance variable of the type RecordList. Take a look and see what methods this class calls, and see if you can figure out if it's missing anything. Also in BLMDB there's a runAllTests() method but it seems to be empty. You'll have to fill it up with all the tests you can think of. It's your job to figure out what you need to check for and figure out how to write tests that can make it clear on the console what tests passed and what didn't. I STRONGLY encourage you to write tests as you go along and not just att the very end. If you want to, in the runAllTests() method, you might want to run a bunch of other little test methods that you write.RecordList.java. The RecordList is just an ArrayList of Records. (Thus, it’s top line is “public class RecordList extends ArrayList<Record>”) But it adds some methods that a regular ArrayList doesn’t have. In particular, it adds a method called sortBy(), in which you can tell it what criterion you want to use to sort it by. (For instance, if you want to sort the records by their description, you could call sortBy(“description”). If you want to sort by their identifier (like the name of the book), you could call sortBy(“identifier”). The sort she had was a version of Insertion Sort -- which is good because Insertion Sort is a stable sort, and that’s important if you’re going to be sorting by multiple criteria. Luckily, Karen had found some code online somewhere for the Insertion Sort method, but unfortunately, the code she found was for sorting an array of ints, and you’ll be sorting an ArrayList of Records, so there will be some differences in the code. There are probably some other helper methods you’ll need here too.ArrayList.java. Of course, you can’t use Java’s built-in ArrayList, you need to build your own. (Sadly, Karen's ArrayList was completely erased.) And your ArrayList needs to be generic, so that you can do things like “ArrayList<Record> r = new ArrayList<Record>();” If your ArrayList isn’t generic yet, you might want to start here.You also might want to add some methods to your ArrayList (or else to your RecordList) that help with your sorting method. For example, a common thing to do in a sorting method is to overwrite an element of an array: myArray[10] = newValue. You might need to write a method so that you can do something like myArrayList.overwrite(10, newValue);In general, if there are any methods called in Karen's classes that look like they're methods of ArrayList (or RecordsList), be sure you have them. If you don't have them, create them.The ArrayList you use could be implemented with a Linked List or with a regular array that resizes when needed.Record.java. This one, luckily, looks fully intact. Take a look at it because it will help you understand other parts of the project. This is the parent class for OnlineRec, Book, and Movie. Notice that the Record class implements the CompareToByInterface.OnlineRec.java , Book.java, and Movie.java. These classes are children of the Record class, but they each add a little more information appropriate to the kind of records that they are. For example, the Book record adds an author and publication year. OnlineRec adds websiteURL. Movie adds a director and a year. These all have to implement the compareToBy method since they are all Records and Record implements CompareToByInterface.CompareToByInterface. Luckily this one is pretty intact as well. Check it out so you know how to build this method in the OnlineRec, Book, and Movie classes.BLM_resources.txt. This is the text file that holds the resources Karen found so far. See if you can figure out the format they need to be in, in order to be read by the BLMDB's import-from-file method. You need to add some more sources to this file.Here are Karen's files (or what's left of them): Will be given to accepted tutorWHAT TO TURN INTurn in a zip drive with all these files in it:BLMDB.javaRecordList.javaRecord.java (this one should be unchanged)CompareToByInterface.java (this one should be unchanged)ArrayList.java (the generic one you made. Also include any other files needed by it. For example, if it inherits from your List.java or if it employs the LinkedListException.java class you made include those.)OnlineRec.javaBook.javaMovie.javaBLM_resources.txt -- with your additional (properly formatted) resourcesALSO: When you turn everything in, you must write a small report in the comments box that pops up when you submit. Let me know what parts you got working , what parts don't, or still need work. Let me know if you feel your coding style is top-notch or needs improving.