Thursday, April 3, 2014

Ye Olde Curiosity App

You get a job because you really want to work with the latest web technologies, right? Well, no, you get a job for a variety of reasons, cool technology being just one of them. In my case, location really matters: I love being in the city. Currently that means Brisbane, but it would be the same wherever I end up. I can meet my friends, check out new bookshops and smokin’ hot office ladies, and do lunchtime language-learnin'.

You might also take a job because it's an exciting new project, a high-profile one, like the Mater Patient Portal project that I was lucky enough to work on a few years ago. Or for this reason. Or for that. A state-of-the-art tech stack is nice to have, but I imagine if you're like me you can grant employers some latitude when it comes to how sharp the bleeding edge has to be if some of the other factors line up.

I recently started a web development contract where I found out there was going to be some MVC4 work, but I would also have to work on a "legacy" web site that was, archaic technology stack notwithstanding, very important "politically". Well, that's perfectly understandable, I thought. We can't just wave a magic wand over every old app and turn it into a Knockout.js single-page HTML5 Bootstrap app running Node.js and all that malarkey, especially not when you're talking about the government.

Rubbish Tip
Flickr Rubbish Tip by LadyBanana

As we headed into Summer I knuckled down, got through some work on the MVC4 app, enjoying the opportunity to get back into EF Code First, which I like using, sweating it out at lunchtime reading 'Antifragile' in the park. And sure enough, I duly put in some grunt work on the legacy app. I rolled up my sleeves, pulled up my socks, shaved, showered, and got stuck in, at one stage spending a month or so refactoring the bejeebus out of it, at the business's behest, mind, which in its own way was satisfying in the way that shaving a homeless guy's beard that hadn't been cut in a year would be satisfying.

It took me a while to understand what was going on in there, amazed that this "politically important" app contained plenty of things that weren't even good enough to qualify as anti-patterns. Unpatterns. Think I exaggerate? Here's an example of what I'm talking about. As is often the case with Asp.Net Web forms pages, one of the main pages in the site accepts a querystring value for the main business entity of the site corresponding to this type of URL: "page.aspx?id=123" whereupon the code would usually go to the database and get the widget whose id is 123. Correct? What this app did, for everything, everything, was get all the records from the table in question and loop through the lot in the (front-end) code until it found the one it was really interested in all along. That way you cleverly get to reuse a repository method with "SELECT * FROM [tablename]" somewhere in it, avoiding pesky branching logic or redundant extra code actually specifying which columns, from which tables, you might want. Oh yes, this app is all about the code reuse.

Nonetheless, I made a few fixes (like that repository apocalypse mentioned above), we had a few successful minor releases to production, Christmas came and went. However and alas, as Autumn loomed the ratio of my time on the Code First app to the amount of time I spent on the legacy app was tipping towards the latter more and more until Ol' Wrinkly was pretty much all I was working on.

So how old was this legacy app? .Net 2 old. But that wasn't really the bad part. That was that it had been allowed to degenerate to the state where the code was atrocious, and the practices used to maintain and update it were not what you'd called "best" by any means. If an app is quite badly coded, there's an excellent chance that everything remotely touching it, all the processes, the database it uses, everything is also in a bad state of disrepair. The actual code in the app is merely symptomatic of greater chaos. If you can imagine a building with broken windows (yes, it's that shopworn old metaphor again!) and graffiti all over it, you're probably imagining a street in a bad neighbourhood, not a single, mysteriously-derelict building in an otherwise well-kept busy, functioning street in a nice area with leafy trees, gourmet coffee joints, BMW dealerships and well-heeled kids.

Time passed; I began to get quite despondent at work. I understood the importance of this app, that it showed important information to journalists and politicians, but I didn't understand the superlax way it was managed and allowed to putrify into a swampy mess, code-wise. Having to work to the beat of an old, decrepit drum got me down. This wasn't what I signed up for: not in this particular job, nor indeed in deciding to be a web developer in the first place.

In my despair, an idea popped into my head. The idea of a deadline. For the sake of my dwindling dopamine levels, I needed to have a end in sight, and soon. I had done my tour of duty and it was time for some IT doughboy to take over. There was a deployment to production coming up with my refactoring changes, as well as some other changes - hey, I would have done them separately too, but I wasn't in charge of that end of things - which suggested a natural termination date. One other thing: I didn't mention this imminent cessation of work to anyone. I knew I'd be talked out of it, or my request would be flat out not entertained whatsoever while there was a big deployment pending.

Once over the deployment line, and it was a fraught line in the event with predictable mutual recriminations, I made my move. I simply said I'm not working on this app any more, no negotiation, sorry. And that was it. I told my boss I would accept the consequences of that, but I couldn't do any more work on it and still be a nice guy. I played the dangerous game called Ultimatum. And this time I was lucky. They agreed that the team in charge of Ol' Wrinkly needed to get a full-time dev to tend to it, and that I should get back to the MVC app. The mothereffing relief.

Now, I have no idea how long it would have taken them to reach that decision if I hadn't piped up and spat the dummy, but I suspect the answer is a long time, more than enough to drive me to resign. An ad for the role went out on Seek, friends of mine saw it, emailed me the details, and asked wasn't I working at this place, wasn't this what I had been working on, and would I recommend it? I said, yes I was, yes it was, and no I wouldn't, and the bit about it being an MVC position was wrong: it was of course an ASP.NET 2 Web Forms website. I alerted my guy in the organisation to this no doubt perfectly innocent slip that somehow had crept into the job listing so he could fix it with the recruitment agency. A couple of weeks later a dev turned up for a two day handover with me. He was a great guy and it was a pleasure to meet him, and it's now his thing. I occasionally write to him and we have a group groan at Ye Old Curiosity App. I know I've given it a jokey title, but these things can suck the life out of you as a working guy, so I take being stuck on an abysmal POS app like I was seriously.

I'm not writing this because I think that you the developer, you the reader should do what I did. I don't know it's a useful pattern of behaviour. I know no-one wants to be told by someone lucky enough to have, for the moment at least, gambled and won what they should do. But the thing is - I don't really see it as gambling - I think developers are a lot more in control than they think they are. And as story-lovin' createures, we learn from hearing about what others have done, just from accumulating evidence of what results from certain events from simply seeing whether or not we can do the same ourselves. Why would anyone want to do this in the first place? Well, in my experience many devs seem to be unhappy at work. Simple as that. Now, maybe that's just how they cope with being in IT, maybe it's part of the culture, to signal that you're impatient with your work's tech stack, etc, and maybe they're not actually unhappy, I understand that. Maybe they actually are unhappy. It doesn't strike me as so unlikely a thing that people might be unhappy having to work all day in an office. All that being passionate about what you do stuff aside, as the man says it's called work for a reason.

Incidentally, a site where people can review companies they work for came to my attention around this time, particularly the page about Dialog, for whom I worked a couple of years ago. This Dialog page would be a good place to link to if you ever wanted to link the word "disgruntled" to anything. Why don't these people change their circumstances? They sound really unhappy, and they want you to think that some big bad man is responsible for their happiness. Nope, that'd be them themselves. The bad man is only responsible for his own happiness.