Learning Journal CST338 - Final Week
Learning Journal — End of Semester 1. Reading my own Project 1 code now Opening Project 1 again, the first thing I noticed is that the code actually reads like something I designed on purpose. When I was writing it, each file felt like its own fire to put out. Rereading it now, I can see the shape of the whole thing: four pile classes implementing one Pile interface, a Game class that orchestrates them, and a Code enum that lets every method report success or failure in a structured way. The class I'd rewrite first is Game.java. Right now it's a fat controller that holds every pile, every flag, and every method for moving cards. It works, but the UI has no way to know when state changes unless something explicitly asks. If I wrote it today I'd apply the Observer pattern: Game would maintain a list of listeners and fire an event after every successful move, and the UI would subscribe instead of polling. That's a real separation of concerns, and it would make the mode...