Saturday, March 8, 2014

Work log - 3/8/14

Whew.  I've got a working set of functions for querying the MongoDB knowledge base component of the program.  The actual query code is decently compact (about 200 lines).  There are also 4 object classes that define the 3 database collections/objects, plus an additional one for convenience in the query code.  Each of those classes is around 75-100 lines, but largely filler stuff like getters and setters.

I decided I really needed some unit testing for this code.  I am a believer in the value of unit testing, but I often don't practice it myself.  I decided to change this by doing comprehensive unit tests for all of the functions used elsewhere I wrote as part of the KBQuery class (6 in total).  The unit testing code is quite large itself, comparable to the actual code it tests (~150 lines versus 200).  That's quite a bit extra to add, but I found several juicy bugs that would have been nasty 'gotchas' through the process of writing and executing those tests.  I think without the tests, my code would still have those bugs until they were discovered in some roundabout way from the other project components calling my stuff.  I think it's gonna be much better to make my stuff as robust as possible before trying to integrate it among the team.

No comments:

Post a Comment