Monday, August 31, 2009

The Joy of Fixtures

I have had a thoroughly unproductive morning - I suppose to balance out my productive weekend. However, you cannot be productive all the time, because it is in those moments of unproductivity that provide the well springs of productivity.

I am about to break for lunch and will perhaps go to the market near the UNICEF building. It is a series of thatched stalls serving local delicaies that Sima and intestines, and of course sim cards. Down the street, there are about 300 worshippers dressed in white - a Christian sect I believe. They have been camping out in an open field for the past 3 weeks, and apparently will be staying another week. I wonder what the occasion is? I figure I could move to the hotel close by - the Sanctuary Lodge - and then walk to the office.It would take me about 15 minutes. I may actually do that.

I spent the weekend shoring up my datamodels, building the basic front end template system and building fixtures. I also joined the local IT listserv and I have already met developers in Blantyre doing SMS development. Will SMS work become obsolete once Africa gets wide GPRS penetration?

This morning I am praising the joy of fixtures.

There are all sorts of methodologies in place in order to control the quality of software. The intention is good. Something like 80% of all software projects fail (this may be an outdated number). I've seen pair programming, extreme programming, agile, object oriented design is supposedly a methodology, then you have aspect oriented design - and the list goes on .

Design patterns are good (Object oriented design for example). The main goal is to provide reusable chunks of code. So like - oh you figured out how to print something - good. I'll use that code in my application for the printing functionality. Design Patterns however also provide a a meta language with which to understand software in general. I write software in at least 5 languages at a given time, to say - oh this piece of code is decorator, or oh this is a singleton - is analogous to saying oh this is a noun, or this is in the subjunctive. It gives me a framework for cross-language comparision. It is a software grammar.

For quality control people are very excited about Unit Testing. Basically with Unit Tests you are writing bits of code that attempt to simulate how someone will use (or misuse a software ). Unit tests are for the smallest atomic element of your software project. For each atom, you write a unit test. The thing is, the person writing the unit test is not really the user. You will never anticipate the real world issues that crop up by writing a unit test.

I am a big believer in fixtures however (a part of unit test methodology). This is why I spent a few hours this weekend writing them. Fixtures are data that essentially 'Fix' your system at a certain state, so that you, or another user, can actually use and test the system. Essentially it is dummy data. The good thing about fixtures is that you see quickly if there are problems with your data model, and with the interactions between your datamodel. Sure there might be something wrong with a functional piece of your code - (ie you may want the maximum height for something but you are actually getting the minimum height). However, this will reveal itself in testing and iterative design. You cannot iterate if you have no data, and if you data models are buggy.

Software quality control is a thorny issue. Software is only as good as the programmer, and the way to become a good programmer is to be naturally talented or to find a good mentor, or to read good code (and perhaps contribute to an open source project), and of course to write code - in a variety of languages.

So this morning, while enjoying my Kiboko breakfast of eggs, fruit salad and tea (I have quit coffee!) I read a poem 'Stepping Westward' by Denise Levertov. When I first read it, I thought it was written by a man. I thought it was absolutely ghastly! Just a terrible poem. (I's about being woman / among other things). But when I went back and reread the poem, after discovering the poet was a woman, I absolutely fell in love with the poem. I often experience the same thing when watching one of my films with different audiences. Some audience make you love your film, and some make you want to go out and play in traffic - what is in the work and what is in your mind?

Some links of interest:
AfNog - african network operators group
Maker Faire Africa
Nubian Cheetah
Dream Manufactory
White African post on SMS vs GPRS in Africa

No comments:

Post a Comment