Posts

Showing posts from December, 2025

week 15-16/100

  HW1 post mortem I’m pretty happy with how I implemented hangman, but we could make some structural changes to be more object oriented-ish.  I would separate out the game state tracking from the game play mechanics. This would make it easier to reuse gameplay scorekeeping logic and let Hangman class be dedicated just to the gameplay mechanics. readFile should be in its own class since it’s also separate from the gameplay mechanics. Something like a HangmanCorpusLoader that could be overridden to load from different kinds of files or from raw streams or from APIs or generate random strings or whatever. Instead of calling new Hangman directly from gameplay, a factory method would be appropriate to encapsulate the constructor implementation.  I might even go so far as to make a separate class for the chosen word itself to hide the logic of word state, tracking letters, etc. from the outer gameplay I/O. Two Big Wins 1. I think the abstracted test logic I made for our project...