Thursday, November 24, 2005

Migration to Xerces from TinyXML

I have recently migrated from MSVC 2003 to 2005, because I saw it fix and improve lots of things that I could barely stand in 2003. There was a drawback of course. My xml wrapper refused to work in release but worked well in debug mode. The implementation sat on top of tinyXML, which seemed to have problem with using latest MS SDK. So I figured it was the right time to move away from tinyXML to Xerces-c. Now I do not recommend choosing Xerces-c as an easy to start with xml library, but it certainly is powerful nonetheless. It took a bit to understand that it had some rather weird approaches to handling strings. Now I can understand having to encode strings into a format that support various encoding and such, but the usage of those character arrays is simply bad. A user must be constanly on look out for cleaning up decoded and encoded character arrays. I did a few things to make my life easier with it, but still it did not feel right.

The good thing is that unit tests helped me out to ensure that the wrapper works, so that now I can forget about Xerces-c lame duck interface, and hide behind XML tools that I have written on top of it.

Overall, it took only about day and a half to complete migration which is pretty good considering that I have not worked with Xerces-c beforehand. Xerces-c is not bad, though, don't get me wrong, there are plenty of good things like easy DOM parsing and XML tree browsing, but you need to watch your step, because there are plenty of hidden traps in its workings. But the main problem was almost complete luck of decent documentation. Website did not have any examples, instead sending you to download the examples that come with the source. Those examples weren't bad, but almost none of them were simply. It took some critical thinking to figure out what I need and what I don't.

I tried to find some tutorials for Xerces-c but could not find any. Very dissapointing. Xerces is one of the Apache components, and yet lucks useful documentation. And worse, it seems that there isn't any community around it to help out newcomers.

In conclusion, Xerces-c is good enough to be used after climbing its high wall, but it does not provide nice interface ( complete C++ and STL would be really nice ) and lucks documentation and community support.

Thursday, November 10, 2005

Unit Testing

Unit testing is an old concept that has been around long before computers came to life. You test what you make to ensure its quality. I have been putting off serious unit testing in this project for a while now. But lately I decided it was time to start writing complete unit tests to ensure quality of the project.

One of the last drops was a recent performance bug, that I have not nailed, so unit tests are coming to aid.

I started from simple components: math and XML tools. Next turn will be graphics and physics components.

I am using a very simple and handy QuickTest written by Tyler Streeter. Many thanks goes to him.