Decoupling Ui from Tic Tac Toe
20 Aug 2012
Sometimes you have to break things apart to make them better.
After talking with Doug about the issues I was having converting my Console TTT (Tic-Tac-Toe) to the web, he offered me a solution...Rethink my architecture.
He pointed out that I had dependencies that were making it difficult to convert my app gracefully. He suggested I watch Uncle Bob's Clean Coders video Episode 7 - Architecture, Use Cases, and High Level Design.
As Uncle Bob was talking about how Architecture Exposes Usage, I couldn't help but think about the book, "The Timeless Way of Building" by Christopher Alexander. (Which I love by the way. Special thanks to Cory Foy for the recommendation.) The parallel was another reason to help solidify the argument for emerging patterns in good and bad design. Uncle Bob then goes on to use an example about accounting software. He says that if you are shown an accounting software that is used over the web, the first thing it should scream to you is ACCOUNTING SOFTWARE not WEB APPLICATION. You should be able to change the delivery mechanism without having to change the architecture.
Uh oh, I have some work to do! Although not terrible,(I quite liked my Console App before I knew what I know now. :) ) I have some pain points in my application. Some of them are reoccurring. I wish I could say that I had the solution right now, but I am still working on it. I have some questions but am confident once I get the answers, I will be able to move more things into place. I decided to go through each class, identify the methods that are suspect, and question the purpose and motives of each class, and start moving things around.
I really enjoyed the video and look forward to an even cleaner iteration of my TTT. I'll keep you posted. :)