When Just Working Isn’t Good Enough

tttvbI wrote a tic tac toe game for my Windows Phone today. It works just fine. I’m just not happy with it. I loaded a screen shot of it to the left. Oh it is obvious that the graphics are not so hot. Graphic design and UI design are just not my thing. I’m actually pretty happy that (in theory at least) I could give the XAML code off and have someone who is good at design fix it all up for me so I could just worry about the code. No, it’s the code I am unhappy with. Why? Well it’s a mess. It wasn’t designed. Now I’ve written multiple tic tac toe programs in my time. I know how it should work. But each time I just wing it. With close to 40 years of programming behind me I do a fairly good job of winging it. Unfortunately that same experience lets me recognize poor design when I see it. So what went wrong? Generally that old ready, fire aim mentality crept in to the process. You see I didn’t set out to write a great tic tac toe program. I set out to learn some Silverlight for Windows Phone development. So my focus was on other things than writing the best tic tac toe program I could write. In retrospect every tic tac toe program I have ever written was not written to write a great tic tac toe program but to either teach or learn some concept, tool, or idea. This is, unfortunately, all too often an occurrence for what I might call educational programming. I had a student complain once that the Advanced Placement Computer Science exam was one big set of examples about how not to program. It was hard to argue with him.

Sometimes this is ok. Sometimes doing it right means too much complication or at least too many lines of code for use in a test or as a simple concept example. Pro developer examples generally don’t go that route though. They are, usually, examples of exactly how to do it right. They’re great for professionals to learn from but too often are completely overwhelming for raw beginners. is there a middle ground? I’d like to think so. Finding it is the trick though.

I have a couple of example programs I have been using lately (Tic tac toe, Whack a Mole, and Pong) that are optimized for fast and easy creation in a demo or hands on lab setting. There is just a ton wrong with them. The tic tac toe and whack a mole could greatly benefit from some well designed custom object classes for example. The Pong (which in my defense someone else wrote but I have translated into VB fro the original C#) just takes too many shortcuts. All three programs look like they could have been written by a beginning programmer. What I have decided to do is to take some time and do all three of these game a lot closer to right. It’s a point of personal pride which I why I an posting this. I want people to ask me from time to time when they are going to see the results. You know – just to keep me on my toes.

Designed programs work better than hacked together programs. They are easier to debug, to maintain, to enhance and they look better. To me at least there is a feeling of satisfaction from a well designed and developed program that I just don’t get from something I have hacked together. I know that not everyone feels this way. I sure know that for some students just having a piece of code that compiles and meets the minimum standards is success. And that is fine as far as it goes. Other people pride themselves on hacking things together with at least the illusion of development speed unhindered by “wasted time” planning. That is just not me. Slapping things together today made me realize that I need more. I need that planning first. I need my code to be designed. I need to take the time to avoid coding bugs. No matter how much I tested today I just don’t feel as comfortable as I’d like that it is going to work in all cases. And that is not good enough.