I am currently rebuilding the results administration software for Nimble. Instead of using python, this client is built in Java. Why? Well because Swing is the only crossplatform GUI that feels like you are modeling a GUI instead of coding it. And Java is not that bad, if you ignore the fact that you can not do multiple inheritance (I'm problably just spoiled with python).
The system is pretty much eventbased. All calculations are done when needed based on signals from the basic data structures and it does so pretty quick and flawless. Except when I tried to combine results from two (or more) result lists into one.
To give you a clue: results are saved as map from competitor to an achieved score. This is calculated by a hotpluggable calculator (from score sheet to calculated result) and sorted by a Comparator. There is a slight form of misuse here: the Comparator's compareTo-function returns 0 when two results are equals (regardless of the competitor) and the equals-function of the result compares the competitors. So, yes, technically this is a bad idea. But it works in my own sortedset implementation, because now I can name ex aequos.
This worked flawlessly, but began to fault when I wanted to create a combined result (two courses added as a sort of competition). It looked like someone put on the random-bug-generator®. Some results were combined, others only registered one of two results. This was very irritating because a similar thing (teams) already worked, although that was within one result list and this one contained the results of two lists.
What to do? Debug! Debug like your life depends on it! So I hooked everything up and after a morning of manly debugging, I found the problem: misuse of equals and compareTo. When my custom sorter had to resort an item because it signalled it had changed, it removed it from the underlying List and readded it. This worked until now, but I forgot one important thing: the ArrayList responsible uses equals to check if the item is the same... And because I was adding multiple results of the same competitor, it was a question of who came first. Because the competitors were the same, the ArrayList did not care! And in its good right. The fix was as simple as can be: iterate over the list and check for equals and the compareTo.
My bum hurts, but I sure am glad I caught this one. The fault could have been caught earlier if I was not debugging the combined of two team results, with a calculator based on rank :(