Friday, September 26, 2008

Surprised While Porting to IronPython 2

Ronnie Maor has blogged about his experiences of porting an IronPython 1 codebase to IronPython 2. The biggest change of course is the hosting API - which has changed completely. From the inside it is "just Python" and so the only changes should be fewer (and different) bugs. However, there are few subtle changes - like the ordering of essentially unordered collections like the dictionary and set - that revealed "hidden assumptions" in his code and tests:
My conclusions from this are:
  1. If it's not tested it doesn't work. And when you change the environment under which your code runs you need to retest.
  2. The unit tests paid off again, since they allowed me to find many problems in places I didn't expect.
  3. I need to do more to flush out these hidden assumptions. One way is to add a randomized test that runs over longer periods and plays with some variables. I could easily randomize the order in which I go over the checks, inject random errors (the system is supposed to be self healing) or delays in some strategic points, etc. The not-so-easy part is verifying the system behaved correctly, and being able to reproduce problems once they surface.
  4. Would be really good if I had code coverage tools. Don't think there's anything available for IPy :-(
  5. This happens every time I port non-trivial code. Need to stop being surprised :-)

No comments:

Post a Comment

Note: only a member of this blog may post a comment.