Failed

On Tuesday I wrote about the start of this week’s gig. Now that the week is over I guess an update is in order.

In summary; I failed to work miracles this week…

Monday and Tuesday were spent on the low hanging fruit. Lots of simple transformations that made the code less flexible made it easier to see the wood for the trees. By the end of Tuesday I’d moved the code into a library, slipped in several interfaces, mocked up a few things and written a handful of tests. At that stage it was clear that the code was far from complete and far from bug free. What’s more the design was visibly creaking, we had one long class hierarchy of interfaces that ended in a big lumpy base class that contained heaps of rubbish and then exploded into a collection of derived classes that did things that were pretty much unrelated. Different classes used different parts of the shared base class and the interfaces weren’t used in different places at all. Think upside down firework, long streak of classes, big fat explosion, crap flying out in all directions… It was all just light and noise. Fairly horrible noise…

I explained all of this to the client and spent some more time with the parent of this mess. Bit by bit the story came out.

The original version of the code had been developed in a RAD style over a six month period but it was yet to go live. I assume that the RAD they spoke of means Really Atrocious Development as it sure as hell can’t mean anything else. As the original version of the code neared production readiness - i.e. it didn’t bring the whole system down quite so often - they had a new requirement for a new trade type and the RAD nature of the original development wouldn’t stretch to incorporate the new functionality. They couldn’t go live without the new stuff but the new stuff didn’t fit. The developer decided to ‘refactor’ the code into a new structure that would make adding the new functionality really easy; he expected it would take a week. Three weeks down the line and the system seems no nearer being production ready. The new system (upside down firework design) was supposed to handle the new case better; it did theoretically, it just didn’t do everything the original did and it was buggy, over complicated and leaked memory like something I can’t remember…

We sketched a quick redesign together. Rather than one common base that did everything we ended up with 4 different classes. A container that contained a group of categories which in turn could contain categories (etc, etc, etc) until eventually, only at the lowest category level, we had items which had elements. The original classes did all this with lots of special cases in the one big ball of almost common code. The sketched redesign did it in several distinct classes that did distinctly different things.

The parent accepted the shortcomings of his creation but kinda hoped I would just wave a magic wand and fix it all. We tried but it quickly, very quickly, became obvious that we just didn’t have a hope of fixing the design and then reimplementing all of the 40000 lines (allegedly) of code in 1.3 days before their go live date… It seemed, to me, that it would probably be better for him to try and shoehorn the new functionality into the original design - which was much more complete and much more stable - rather than trying to finish the new design, fix all the new bugs and move all the functionality and then add the new functionality… Either way he was on a hiding to nothing…

So that’s what he’s currently trying to do. He was happy with the new structure that we achieved on Monday and Tuesday and he liked the fact he now had some tests and could write more. I honestly can’t see them hitting their Sunday ship date, but who knows. He’s confident he can do it, or at least he’s refusing to admit to anyone that he can’t do it or even suggest that there’s a chance he can’t do it… I’m back with them on Tuesday so we’ll see how they did…

I found it really quite hard to admit defeat but knew I had to. The client had other issues that I could deal with and, although this was the most pressing, they weren’t going to get the best value from me by having me spend all of the time I had with them trying to understand the mess that their proud parent was in and help him drag his errant child back onto the straight and narrow. He knew the situation far better than I and it would be more efficient for him to fix his problems and me to look at the other issues they had for me.

So, I failed to work miracles :( but I got 50% of the other issues sorted out for them, so it wasn’t an entirely wasted week.