Wk03 Learning Journal: HW 1 Code Review
Whose code did you review?
I reviewed the HW01 code from two classmates: Faith Thomas and Luis Valadez.
Faith Thomas’ Code:
Faith’s code is functionally well-organized and readable. Most variable names are meaningful and self-explanatory. For instance, names like guessedWords, remainingGuesses, and numberOfHints clearly communicate their purpose. There is a good use of comments in some places, though many methods are still marked with TODOs for Javadoc comments. Some logic could be improved for clarity, such as simplifying the chooseWord method or extracting logic into helper methods. I also noted that debug System.out.println statements were scattered throughout and should ideally be removed or toggled with a debug flag.
Unused import statements weren’t an issue, but formatting could be a bit more consistent in terms of spacing and indentation. All unit tests passed, and it does not appear that the tests were modified, which is good.
Luis Valadez’s Code:
Luis’s code was well-structured and more complete in terms of Javadoc comments. His use of a do-while loop in chooseWord() to avoid repeated words was a smart and effective solution. His formatting was consistent, and variable naming was clean and meaningful. I liked how he gracefully handled edge cases like empty strings when reading from files. He also added a unique touch by returning -42 when exit() fails—creative, though it might be better to throw an exception or use a more standard approach. All unit tests passed, and no test files were modified.
Summary of the feedback you received about your code from your peers:
Faith said my code looked good overall and was easy to follow. She mentioned that my variable names were clear, which made it simple to understand what each part was doing. She also appreciated that my comments helped explain the code. The only suggestion she had was to remove a commented-out print statement in the getHint() method on line 243 to reduce clutter. Other than that, she said everything was organized and worked as expected.
Luis said that the variables I used in my program were meaningful and clearly reflected their purpose. He mentioned that I only used a few variables like “ran” for randomization, “scan” for Scanner, and “c” for char, which helped keep the code simple and easy to follow. He appreciated that I added comments to explain the logic behind the code, making it easier to understand why things were done a certain way. The only part he thought could be improved was the hasWon() method, where he noted it might have been done more efficiently in one line, as hinted at in the Javadoc. Other than that, he said there were no issues with warnings, unused imports, or test failures, and everything ran successfully.
Trends I noticed in peer code reviews:
A shared challenge across all of us was consistently adding proper Javadoc documentation. Everyone used debug print statements liberally during development but forgot to remove or disable them afterward. Another common struggle was handling word repetition in chooseWord(), which Luis handled elegantly, while Faith took a more manual approach.
Answers to the following:
What improvements would you make to your code/what was suggested?
I would improve documentation by completing all Javadoc comments and better explaining my code logic in tricky areas like the hint system.Which unit tests were the hardest to pass?
The tests related to formatting (like displayGameState) were most difficult since even a missing newline or space would cause a failure.How do the existing tests function and could they be improved? Do the existing unit tests cover the full range of the sub classes?
The tests did a good job covering the expected behavior of the code! It allowed me to catch any issues early on. I do think there could've been more testing to help with more failure scenarios. I believe with a few more tests it would feel more complete! I do believe that the unit tests cover the majority of the functionality. However, if I were to improve anything, I would add more tests focused on edge
behaviors for each subclass!
What did you struggle with?
Getting my program’s output to match the exact formatting expected by the unit tests was frustrating, as well as making sure I had correct spacing in my print statements and such. I also struggled making sure my methods handled every possible input.What did one of your teammates struggle with?
From our reviews, I noticed that it was a common struggle to remember to remove debug print statements and to remember to add javaDoc comments. It is hard to remember the little things when the code is finally working!
Was any part of the code a struggle for YOU?
I personally struggled with understanding the hasWon() logic. I knew my code worked, but I also knew there had to be a more efficient way to write it. It also would break other parts when I went to edit the code.Was any part of writing the code easy for YOU?
Structuring my variables and adding comments to things was easy for me. I was hoping my code would be easy enough to follow, so I could come back later and easily explain what was happening.What was your biggest HW01 victory?
My biggest win with HW01 was that my tests passed the first try, not entirely sure how haha, the code needed minor fixes from there, which was so rewarding. Another win was the positive feedback I received from my team, which helped build my confidence a little!
Comments
Post a Comment