Code Review
I reviewed code from Khanh, Glenn, and Jack for the Hangman assignment. There weren’t many major improvements to be made. The assignment was fairly straightforward, so we all followed the instructions and produced similar code. Here are the reviews I shared with my classmates:



Here are some positive trends I noticed about the code I reviewed:
- All of the tests passed, and the game worked correctly with each student’s code.
- Adding a conditional to check if a variable is null or a
Listis empty. It’s important to do this to prevent runtime errors. - Using a do-while loop in the
chooseWordmethod. This makes sense because the loop may or may not need to repeat, depending on if the randomly selected word has been guessed already.
There is always room for some improvement though. Here are a couple things I noticed that could be improved:
- Throwing an error with more specific messages, to help debugging.
- Making sure to remove TODO comments once they are resolved.
- Using imports instead of fully-qualified class names (FQCNs).
The reviews I received from my classmates were generally positive. One reviewer mentioned that I could improve my code’s comments by including them throughout the code instead of just using javadoc comments. I agree that it can often be helpful to have comments in code to explain specific parts.
Takeaways
I think the hardest part of this assignment was just wrapping my head around the documentation and how the code is supposed to function. The biggest victory from the assignment for me was developing the practical skill of onboarding to a new codebase. Onboarding to an unfamiliar codebase can often be a challenge, but once you get the hang of it, you can develop strategies to make it easier.
For example, one thing I’ll do is to make sure the code is syntactically correct before implementing any logic. Fixing the syntax errors will usually allow the code to compile, which is always a step in the right direction. From there, it’s a lot easier to focus on getting the tests to pass and following the assignment’s instructions on how to implement the code.
One thing that could help make the code more testable is to have the Hangman class handle its own input, instead of having a separate GameLoader class handle input. Being able to test the entire game end-to-end within a single class would make it easier to verify the complete functionality of the game, so that any issues would be isolated to a single class.