Saturday, January 1, 2011

Re-inventing the Wheel

Happy New Year everyone. My resolution for the new year is to try and post at least once a week, most likely on Sundays but I am posting this a day early due to the date.

I am one of those programmers who suffers from Not Invented Here (NIH) Syndrome. This is a common affliction where programmers tend to prefer writing their own code rather than using existing libraries. In my case this condition was the result of having to use too many bad libraries earlier in my carrier so even though there are really good programming libraries available, many free or open source, the third degree burns from the past make me leery. The worst case for me was a deadlock which occurred in a very expensive library that a company I was doing consulting work for was using. There is nothing more awful then having a deadlock condition in your code only to find that the deadlock is happening in the library you are using for which you have no source code. This is probably a better reason for open source than Richard Stallman's reason.

The problem with NIH Syndrome is that time is spent writing your own libraries instead of using perfectly good libraries which already exist. Sometimes there are good reasons not to use the libraries so the opposite affliction also exists and is a worse condition as it leads to far too many script-kiddies. It is my opinion that there is nothing worse than a "programmer" who simply is not able to program. Still, it is always important to take a look at the requirements for your program and decide if using a third party library is appropriate or if your requirements are best served by reinventing the wheel.

In the case of Dozen Days of Tiles, the situation is not exactly the same as it isn't libraries that are being considered but whether to use HTML Form tags and CSS3 to handle the buttons and checkboxes or if custom code should be written. Still, knowing my NIH problem, thought had to be made about this.

The HTML Tags for buttons and checkboxes exist, and are easy to use. With CSS3 it is possible to have vast control over the look, feel, and positioning of these elements. The problem is that the rendering is done by the browser and are not part of the canvas. When you add the fact that games are visual in nature so being able to control all aspects of the interface are important, this lack of control and potential problems that having to deal with browser compatibility is probably a good enough reason to write some simple user interface classes. My own biases probably are a big factor in this decision, but it should only take a couple of hours to do the work so it isn't that big of a cost.

So with my poor rational for the decision is out of the way, the next step in the sudoku player is to write some user interface code.

No comments: