Back to Basics
In my last post I discussed wiring up my Limelight UI to my existing tic tac toe code and how “smoothly” things had gone. I recreated all of the methods that my CommandLineInterface class had (and that the Game class expected) inside of my LimelightUI class, and after a couple of tweaks I had everything running just as it did in my command line.
Should Have Listened to My Gut
However, I wasn’t entirely satisfied with my implementation and I could definitely feel some tension in those tweaks I had to make. When Mike looked over the code he could see that tension as well and he sent me back to the drawing board (literally) to consider the different responsibilities of my Game and UI classes and how I might be able to create a better interface for my tic toe module (the Game, Board and Player classes). He also asked me to consider how I might integrate it all into my old Rails app.
Maybe my brain just started filling up a little earlier than usual this week, but when I started to think about concepts like dependencies, responsibilities and creating an interface in a language that doesn’t use explicit interfaces, things definitely weren’t as concrete in my head as I wanted them to be. These are all things I know about insofar as I’ve read some chapters in books about them, but that doesn’t mean that I really know them. Plus, Mike recommended I maybe do some UML diagramming to help me conceptualize it all, and although I’ve seen lots of UML diagrams in the PPP book I don’t actually understand the specifics behind them.
Rewiring this Limelight class and creating a good interface was going to require some thinking… and as Uncle Bob tells us: “there’s nothing wrong with thinking.”
No Code Day
So, with the exception of one kata this morning I actually didn’t write much code today. Instead I read a lot of code, popped open the PPP Book, a copy of Martin Fowler’s “Refactoring:Ruby Edition”, and for good measure I also started reading through Fowler’s UML Distilled.
Slightly More Experience
I’d already read both the SOLID principles section of the PPP book and the opening of “Refactoring” before, but now that I had slightly more code under my belt from learning limelight the past couple of weeks, hooking it up to my code, and also getting to work on the internal project- I can definitely conceptualize the “big picture” concepts just a little bit better and I have a few ideas about how I might be able to do this rewiring. I’m also thinking that I might even implement one of the design patterns I’ve studies thus far. I don’t want to get too carried away though— I better just take it one step at a time for now.