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 2 repository class is pretty neat. The race conditions with the production threadpool caused problems in testing. Figuring out the single threading and in memory db to inject into the repository was a win, and then making a typed class so we could abstract out all the thread management from the test conditions for each query was pretty fun and reduced the amount of copy/pasting to be able to test all our methods.


2. It has been over a decade since I wrote an android application, and a lot changed. I vibe coded one a couple years ago but that was not rewarding at all. Learning the Room abstraction and getting familiar with modern app development was great. Generally I love practicing different languages, and after spending most of my time in python and typescript it was refreshing to spend time working with java design patterns.


Comments

Popular posts from this blog

Week 2/100

Week 4/100

Industry Expert Interview