Tuesday, January 30, 2007
Wednesday, January 24, 2007
Return
This afternoon I need to look at and fix some of the variables that are throwing obvious errors (returning zero as a value) I believe I may be done with the principle build by the end of the weekend and can then schedule final testing.
Sunday, January 21, 2007
Rest_Read_Rest_ [code?]
I plan to finish off the "Sith Realms 21" game this week for the most part minus final testing (unit testing and benchmark testing last week brought me to a nice point allowing me to take this break). I am hoping tomorrow brings the urge and resolution for completion of this project. Hoping.
Monday, January 15, 2007
The Glory of a Proper Algo
It requires a forward push. It requires a faith in numbers, a spirit that reminds one of the truths when an algo produces negative results :"It is not I, fool-- my form is gracious. It is you who does not understand the depths of my language nor how to speak of my ways." So true.
But, I try to push forward, day after day, and I see the sun skirt the glacial faces as the winds break free upon the Northern realms above. I must prepare better for my ascent.
Wednesday, January 10, 2007
The Importance of Unit Testing
Tuesday, January 09, 2007
Testing: by Evelyn Mitchell
The 17th century German philosopher and poet Novalis said, "Most marriages are divorces." Had he been a software developer, he might have said, "Most programming is maintenance." Still, with careful testing from the outset, the maintenance of existing programs can be made much easier, but only if the effort of writing and running tests is justified.
Unit testing is the process of testing code as you write it. You can also use unit testing during regression testing, in which you determine if a program is working the way it did before you modified it. Unit testing is also known as "white box" or "glass box testing," as opposed to "black box testing."
Black box testing is, roughly speaking, testing done by someone who does not have access to the program's code. In black box testing the program is viewed (you might have guessed) as a black box that takes inputs and produces outputs, but doesn't reveal its internal structure. By contrast, unit testing exercises your full knowledge of the code by testing the interfaces to other code components and to user space, as well as the implementation.
Unit testing fully tests every interesting function a program performs. You can test for unusual data, or for combinations of values that should always or must never occur. You can even use it for coverage testing, to make sure that you've exercised every path through a program.
You can write the unit tests once you understand what you want a module to do, even before you've actually written the module. Kent Beck (author of Test Infected: Programmers Love Writing Tests -- see Resources) recommends writing the tests before you write the code because they can help to clarify your understanding of what the module is supposed to do independent of how it will do it, thereby separating design testing from implementation testing. If you can't write a test for a module before you write the module, that may suggest that you do not understand the design, or that the design has an error. If you can catch a design error at this stage, you've just saved yourself some coding time.
A unit testing framework, such as PythonUnit, makes it easy to test your code after every change, no matter how trivial. I work with multiple windows open -- one for the code I'm editing, one for the testing -- and I pop back and forth as I make changes.
This makes finding errors simpler because you know that the change you just made caused your test to fail. Frequent testing can eliminate those multi-hour debugging sessions where your code gets filled with print statements while you try to find that good line gone bad.
Writing all those test cases may seem like a lot of work, but I find it to be a very effective way of learning how a new piece of code functions (or doesn't function the way I thought it did). The time I spend writing tests is time I would have spent guessing about how something works, to no good end.
The simple fact is that the earlier you find a bug and fix it, the cheaper the fix is.
Monday, January 08, 2007
Twisted Variables and Flying Roaches: The Mighty Dogfight

It is not unlike a WWI dogfight sometimes: You know that the enemy stalks the horizon. You hear the hum of his engines and the whirl of propellers. Your instinct tells you that if you come in contact with your opponent it will be a nasty fight, but you fly on. You now see their canvas wings as you draw closer-- they are not quite the enemy you feared. But, they let loose with a barrage of lead volleys that almost gaze your leather helmet and punches holes in your planes skin. You tilt and roll racing towards the Earth not in pursuit of a fiery death but only as a defensive move to regain your arial footing and produce a new, aggressive stance. Your co-pilot screams for you to blaze a trail to the heart of your enemy even if it means both your deaths. Victory is possibly only a moment away. Your tear loose with an attack of machine gun fire that strikes the enemy pilot in his hands and his head. That plane now falls free and bleeding smoke, a torn kite now fuming with sure defeat; the dead, enemy craft thrashes the ground not unlike a shattered spear and explodes in a glorious gulp. Your co-pilot yells "Aces High!" and you prepare to return to base. You have just won this round and you can rest perhaps for a moment. Your team will seek and search to recover the destroyed enemy plane to study the wreckage for secrets and technological advancement-- all you do is fall into your bunk and retire with victory for a few hours in dreams of blasts and breath-stealing bail-outs. You will awake in a sweat for another take.
Such is the days of a programmer at times. Although I am making use of lofty, dated imagery and metaphor to describe my struggles with code at times, it is how I feel it at the moment and I pray for victory and yearn to return to base, perhaps to gun another day for all the twisted variables, redundant code bunkers, and the notorious bugs who fly in bomber-formation in search of birthing a firsescape in our eyes. Aces High!