Monday 7 November 2011

Riding the Tiger

Amos left at the start of my second year at Tigerland and Meggs took over his role, as well as continuing with his own duties. The first thing that he needed to do was to replace Amos.

Meggs decided that he needed someone pretty serious to replace his compadre; somebody both skilled and experienced. And so he set about interviewing candidates for the role of a senior developer.

I was not present for any of the interviews, but I heard about what had happened from the technical director and from Meggs himself. Meggs reduced at least one candidate to tears during the interview process. For other candidates, if they were not doing well enough in the testing, he would get up and leave the room without saying a word.

Eventually, Meggs settled on a developer named Ivan. He didn't particularly like Ivan, but he was the only candidate who had actually passed Meggs' testing and soon enough Ivan joined us in the fishbowl. Ivan was very pleased to be in the role, and he expressed to me his delight about how much he was learning from Meggs, about how great a pleasure it was to be exposed to an intellect like that. No matter how badly Meggs treated him, Ivan seemed to be okay with it. I have never seen anything like it before or since.

Every day, for a solid half an hour just prior to lunchtime, Meggs would stand over Ivan and bellow at him;  insulting his work, his integrity, his experience and his intelligence. I remember Ivan's work being clean and tight and clear. He met all of Meggs' style guidelines and everything I ever saw of it looked good. Ivan was the only candidate who passed Meggs' screening; I'm pretty sure the problem was not actually in his court. Meggs liked to be feared, and without his friend Amos to snicker about it with he was probably lonely as well.

I started having my own problems with Meggs. His desk was abotu a meter and a half from my own and he started watching me over my shoulder. Meggs decided that I was compiling the source code a bit too often, which was costing me a valuable half minute or two each time I pressed F9. "Jared. You only need to recompile the module you're working in. Be more productive." Meggs' own productivity was tailing off, because, for one thing, he was spending so much time watching me when he wasn't yelling at Ivan.

Meggs assigned me a fairly complicated piece of logic to do involving persistent locking. My first attempt was a failure; I hadn't understood the idea of it properly and it didn't work when there was more than one client connected (which defeated the purpose of the exercise). Barely controlling his impatience, Meggs explained it in more detail, and even drew  me a picture on a scrap of paper and told me to build it. This was the first time I'd ever been shown a design drawing for anything at Tigerland... and, let me be honest, through the rest of my career, I've rarely seen a design drawing for anything that I didn't author myself. I any case, it made an impression on me.

This time I understood what was going on properly. I looked at the design carefully and I noticed what looked like a bad side effect. "No, that's the behaviour I want," said Meggs.
"Well, okay, then," I said.

I went and set up the locking the way he had asked. When the task was done he code reviewed it and I checked it in... and then I threw away the drawing.

About two weeks later, I found myself on the receiving end of a tongue-lashing on the same scale as the ones Ivan was subjected to. "Pikeman! This locking system you built is rubbish! Have you seen this side effect?"
"Meggs, I told you that was going to happen."
"I would never have agreed to that!"
"But... it was your design! I built it exactly the way you asked me to! You even drew me a picture!"
"Where's this picture, then?"
I've never thrown away a design drawing since.

By now Meggs had stopped contributing any code to the product. Ivan was building a special new feature, but it was Guthrie and I doing 80% of the work fixing bugs and migrating across to the new design. But it wasn't just the architecture changing. Meggs was making ad hoc changes to the feature set and functionality as  we went.

Meanwhile, I was becoming more and more interested in the design of the new infrastructure. I suggested to Meggs that it would be really nice if you could tell the framework what the cardinal relationship between different kinds of entities was and have it generate queries based on that. Meggs agreed that it was a good idea and he added some code that did indeed identify the relationships... but it was cosmetic only. None of the smarts I wanted to build were present. In hindsight, I think this actually half-assed attempt at an apology. I didn't criticize it but he could see I was disappointed.

The technical director could see that things were going badly. We'd barely enough money to cover costs during the year and the software was badly behind schedule. This latter problem was entirely due to the fact that Meggs kept moving the goalposts; making the design more and more elaborate and forcing us to constantly rework what we had done. He hadn't stopped coding himself, but he was coding a hobbyhorse project that had nothing to do with the work we were putting to market. Aware that something was amiss, the technical director instituted weekly development meetings.

These only made it worse. Meggs began to use the forums to taking credit for other people's ideas. Most usually, those ideas were mine. Sometimes Meggs would get the ideas wrong and miss the point... and if I would pipe up to correct him he would repeat what I said back to me, in front of the whole room, as if I was too dense to understand them.

Suddenly I was no longer afraid of Meggs anymore. I had learned a lot from him, but I knew that he was no longer this infallible font of technical wisdom. He had taught me that the design was the most important part of an engineer's job and I was going to stand by that principal, regardless of his sensitive ego.

Meggs' new design ideas were all to do with preventing programmers from making mistakes where his framework became unintuitive or failed to handle errors well, and I was assigned the task of making the little classes that would enforce this... classes that soon be scattered through the codebase like a bucket full or rabbit pellets. I didn't complain, but I became sly about it, and I started making these turd classes more and more elaborate; decorating them with superfluous template parameters and inheritance hierarchies. These exquisitely-polished turds passed through Meggs' formerly-rigorous code reviews without comment. I turned one of these projects (a particularly bad mixed-metaphor turd class) into a three-week-long project which to this day is one of the most conceptually-complicated and difficult pieces of technology I've ever worked on.

Meggs was even less attentive than ever, and Ivan was copping worse and worse abuse every day. In a bid to get me out of his hair, Meggs assigned me to port one of the biggest modules in the product across to his new framework, with a number or revisions to the functionality that he laid out in an email.

It was a disaster. If we'd ported the module as it was that would all have been fine, but the functionality changes were going to take a module that was compact and well featured and useful and turn it into something no customer would ever have a use for. Usually I wouldn't have known or cared about the customer's end of the experience, but we used that module internally to manage our development database, so, unlike some other areas of the application, I knew it inside out. The development team used that module on a daily basis in the same way that our customers did.

I told Meggs it was a bad idea. We argued loudly about it for a full day, but I refused to give ground. We left it over the weekend and took it to the development meeting the following monday morning.

Words got heated, but there was no yelling. Eventually the technical director threw up his hands and said "Pike, just do it the way Meggs wants it."

I went back to my desk and went to it like a man possessed. I was determined to get the work done as quickly as possible so that Meggs could see what a disaster it was before he forgot the arguments and blamed me for it. I didn't speak a word, I don't think I took a lunch break. I don't think I have ever produced as much code as I did in the following forty eight hours.

Once I had written most of the code and fallen once more into the sleepy cycles that followed which involved running the regression test suite and writing new tests... but mostly staring at the screen while the tests executed... once the anger started to fade... I realized that it was a futile exercise.

I have a vivid memory of going to a camera store with my mother when I was a boy. There had been some problem in developing a roll of holiday snaps and my mother was furious. The man in the camera store was an old Indian man. He stayed calm and my mother settled down. Once they had reached a peaceable agreement, he told her that he was glad. "You came in here riding the tiger," he said. "But don't you feel better now that you have climbed off?"

That was what I had to do. It was time to climb down from the tiger.