Week 2 Markov Homework and Project Progress

In the previous week, a lot of the work that was done involved getting comfortable with github and git workflow, and understanding uml diagrams. I think working along the videos of lab01 project one starter and the WK01HW03 uml and junit assignment provided me a broader understanding of how to utilize git within Intellij. It refreshed my memory about git's terminal commands and presented multiple ways to commit and push within the Intellij ide. The tips and tricks from these videos will genuinely help with future assignments. Also the coding bat assignments assisted me in gaining further knowledge in Java's syntax. The map and strings sections of coding bat definitely helped with the HW01 Markov assignment and some of the project LDPM. The only difficult part about last week was the string-2 section since I couldn't get 6 stars on that assignment.

This week we were tasked to complete the Markov Text Generation assignment. The lab video provided a great framework for the assignment which allowed me to steadily implement some of the missing methods that we were assigned to do. It's actually really convenient looking back at the list of TODOs in intellij that we made during the lab; I'll definitely keep note of adding those in future assignments so that I can come back to them at a later date. 

Many of the unit tests were quite simple to pass such as the addFromFile, constructor test, endsWithPunctuation, and toStringTest. The most challenging unit test to pass was the getSentence test and the addWord test. The reason the getSentence test was challenging for me was because it took me awhile to think of how to implement the while loop to properly iterate through the keys of the HashMap until it lands on a word that ends in a punctuation. It also didn't help that I implemented the randomWord method incorrectly. I tested the method by running the main class and using one of the simple text files such as spam.txt because it had a sample run in the prompt document. At first it would correctly take the first key and output the appropriate random value from the arraylist, but after it would output a duplicate. It took me awhile to figure out that I needed to reassign the key to a new key using the current word. For future assignments, I'll need to check if a method will call another and correctly implement the other method before working on the main one, and also test it before hand.

The unit test I was most proud of was the addWord test, I was not able to add the words following the key words properly in their appropriate arraylist. When I tested the content of the HashMap by outputting the keys and their appropriate arraylist, they would come out empty. I had to go through different methods from the HashMap class and found that putIfAbsent worked the best to add a key if there isn't one already in it. I thought this and endsWithPunctuation were the most satisfying to pass. 

As for the LDPM project, I had to review how to implement polymorphism especially within Java since I am not too familiar with the syntax. Currently I have all the stubs completed and all I need to do is implement them. I'll have to put all my focus this week on this project since its a large chunk of my grade. 

Comments