Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Role Code: Backend Developer Backend Developer (BD) Role The backend developer writes code that makes use of a PostReaderInterface object implemented by the DW and

Role Code: Backend Developer Backend Developer (BD) Role The backend developer writes code that makes use of a PostReaderInterface object implemented by the DW and a HashtableWithDuplicateKeysInterface object developed by the AE to efficiently store and retrieve information about posts by keywords that are included in their title, or body, or both their title and body. It also provides a method that retrieves statistics about the dataset that is being searched over. The Java interface for this class is as follows: public interface CHSearchBackendInterface { // public CHSearchBackendInterface(HashtableWithDuplicateKeysInterface hashtable, PostReaderInterface postReader); public void loadData(String filename) throws FileNotFoundException; public List findPostsByTitleWords(String words); public List findPostsByBodyWords(String words); public List findPostsByTitleOrBodyWords(String words); public String getStatisticsString(); } you are a Backend Developer, then the code you must write this week makes use of the classes being implemented by the AE and DW. If you are a Frontend Developer, then the code that you must write this week makes use of the class being implemented by the BD. But we cannot wait for them to finish their code before we start writing our own code. So with the least amount of work possible, we'll create placeholder implementations of the interfaces that they are implementing that help us write, compile, and test our own code. We don't want to spend too much time on these placeholders, because they'll get replaced next week by working implementations from our teammates (or in the case of project 1, provided by the course staff). So these classes will not be fully functional, and in many cases will just be hard-coded to only work under the very specific circumstances necessary to pass our tests. Create a new .java file for each of the interfaces listed above, and copy their definitions into these files. Next create a placeholder class for each of the interfaces that your role's code will need to access. When naming these classes, put the initials of your role in place of the word Interface in the corresponding interface name to help avoid name conflicts in the future: when everyone's classes get integrated together. Your placeholder classes should implement their corresponding interfaces, and will need method stubs: definitions that do nothing and return null or a zero-ish value as needed to compile. Here's the list of placeholder classes that should have at the end of this step (which depends on your role for this project): Backend Developer: PostBD, PostReaderBD, HashtableWithDuplicateKeysBD Backend Developer Notes: You only have access to a single HashtableWithDuplicateKeys object (passed as an argument into your constructor), so you'll want a convention to differentiate keywords in titles from keywords in bodies of posts. We recommend appending a short string like "TITLE:" or "BODY:" to the beginning of each word that you are storing or retrieving as a key in/from your hashtable. It'll likely to be helpful (although not strictly required) to have a helper method that can break a string of text into words around spaces. You can also strip punctuation off of these words to ensure that you can find the word "buy" even if is followed by a question mark in a post, like "buy?". You should convert key words to a consistent case before storing them with posts in your hashtable and before searching for them. This should help you search for a word like "the" and find matches that are either "the", "The", or "THE". For searches that include multiple words, you should return a list of all posts that contain any of those words. This list should not include duplicates of any post, so some helper methods may be useful in organizing this functionality.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning C# 2005 Databases

Authors: Karli Watson

1st Edition

0470044063, 978-0470044063

More Books

Students also viewed these Databases questions