"Rejoice! Rejoice! Emmanuel shall come to thee, O' Israel!"

Something was definitely up. Ricardo, the team lead, hadn't stopped singing carols that day. Sure, it was a few weeks before Christmas, but that was hardly an excuse to serenade the whole office. No, something had happened, and Erika was determined to keep out of it.

This wasn't the first time Ricardo had gotten prematurely excited over something. Usually dour and unhappy, when he truly believed in a project, he'd hype himself up about it until there was no talking sense into him. It was best to lie low. If you got sucked in, you'd only be blamed when the inevitable fallout crushed his spirit yet again.

Unfortunately, fate seemed to have it in for Erika. Ricardo made a beeline for her cube, still singing carols.

"I bring ye tidings of great joy!" he announced, knocking on the sidewall of her cube. "They agreed to rewrite the frontend—this time, with a CMS!"

That was good news. Nobody liked the aging frontend, but nobody ever seriously broached the subject of redoing it, not with the usual budget austerity. It worked, and it was "only" six years old, they should be able to patch anything that had security implications and keep it running for another ten years. Just like a used car, right?

The biggest complaint was that it had no Content Management System. Every tiny image tweak Marketing wanted, every news article, every dynamic piece of content was achieved via a promotion. They'd separated content from structure as best they could in small payments on the tech debt over the years, but the prospect of a proper CMS, where they could hand the keys to Marketing and wash their hands of the content, was like Christmas come early. Still, Erika couldn't help but wonder where the catch was.

"What's the deadline?" she asked, already preparing to cringe.

"That's the best part: you won't have to worry about the project or the tech design or anything," Ricardo answered. "They're sending over a couple of guys from the East Branch to run the whole thing. Apparently they've had a CMS for a year now and love it, so they want to build the exact same thing here."

Erika bristled. If they had a CMS in the East Branch, why did they give her so much crap about putting one in Corporate HQ? And now a couple of clowns were coming in to tell the team how to do their jobs?

Sensing her frustration, Ricardo beamed at her. "Hey, don't worry. I know these guys. They're a couple of certified geniuses. I hear they used to work at Google! They know what they're doing, they just need us to supply a few extra pairs of hands and they'll run the whole show. I got Marketing to agree to give them free run of it, carte blanche, whatever they say goes. This is going to be the best project we've ever done!"

A year later, it was almost Christmas yet again—but this time, there were no festivities in the air. Erika's hair had grown out and reverted to its natural colour; she couldn't be bothered to head to the salon, not when every day she felt like drinking herself into a stupor. Marketing seemed bound and determined to take all of IT down and replace them with offshore developers, and with good reason: every test they ran on the shiny new frontend found some new "Critical" bug. Validation was never quite right. The workflow was nothing like the design had promised. The styles were off. The images were wrong. The CMS was serving up content scheduled for the future, but only on Tuesdays. Every bug that got fixed introduced another four.

Ricardo spent most of his time in meetings, trying to quell the Marketing demons and lull them back into their unhappy slumber. Erika's task was testing the application as rapidly as she could, despite no real QA training. If Marketing's testers received another bad build, all hell would break loose. The last glimmer of hope within her suggested that if she could just get a look at the code, maybe she could figure out what was wrong. Maybe she could solve it. There had to be a Node module that could fix the systemic problems, right?

"Which branch is the code on?" asked Erika, passing Ricardo in the hallway. "I thought I'd take a look—"

"Don't you dare." Ricardo actually stopped to grip her shoulders tightly, a terrified look in his eyes. "I thought that last month, and I've regretted it ever since. I've seen things I can never unsee in that codebase. Single letter variable names. Views mixed with models mixed with half-hearted validation. Tabs and spaces together, Erika! As if they belonged that way! Don't you dare throw away your sanity on this project, you hear me?"

Ricardo's theatrics aside, Erika was now more convinced than ever that she had to see the code for herself. Not because she could fix it, but because she was morbidly curious. When Ricardo wasn't looking, she poked around the repo, checked out a working copy, and sneaked home with her laptop and a bottle of chardonnay to see what she could find.

The first file she opened was the account creation workflow. Remembering Ricardo's words about spacing, she ran it through Sublime's re-indention methods before she read any of it. Soon after, she swapped the chardonnay for whiskey, but she began to comprehend the problem: these guys were not developers. They didn't understand how to construct software. Whatever they'd done at the East Branch was, had to be, a fluke. Their best code was all ripped straight from StackOverflow. They were desperately trying to make intelligent decisions, but they kept coming up with bizarre conventions like this one:


function matchPasswordsFn(e) {
        if (!(e && e.type)) return;
        $(e.delegateTarget).off("blur focusout", e.handleObj.selector, matchPasswordsFn);

        var type = e.type,
            txtCnfNewPassword = "#SecurityInfo_ConfirmPassword",
            SecurityInfoConfirmPassword = "#SecurityInfo_ConfirmPassword";
             matchPasswordsFn = function (e) {
            if (!(e && e.type && type === e.type)) return;
            var password = $(e.target);
            switch (!0) {
                case password.is("#SecurityInfo_Password"):
                    if ("string" === typeof SecurityInfoConfirmPassword)
                        SecurityInfoConfirmPassword = password.parents('form').find(SecurityInfoConfirmPassword);
                    SecurityInfoConfirmPassword.prop("pattern", escapeForRegEx(password.val()));
                    break;
                case password.is("#SecurityInfo_NewPassword"):
                    if ("string" === typeof txtCnfNewPassword)
                        txtCnfNewPassword = password.parents('form').find(txtCnfNewPassword);
                    txtCnfNewPassword.prop("pattern", escapeForRegEx(password.val()));
                    break;
            }
        };
        return $(e.delegateTarget).on(type, e.handleObj.selector, matchPasswordsFn), matchPasswordsFn.call(this, e)
    };
    function escapeForRegEx(text){
        return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");

In order to validate that passwords matched, they constructed a regex pattern consisting of the first password, and validated the confirmation password against it. They hand-rolled their own escape library, using (of course) a regex to do the escape.

"When all you have is a regex hammer ..." mused Erika, pouring herself another whiskey sour.

The project limped along, much more successful once Erika stopped testing and started fixing. The number of bugs slowly reduced. While the project was still a turd, at least it was a turd with a CMS, which was better than they'd been working with before. The launch party was mellow and subdued, mostly sporting an air of relief that the darn thing got into production at all.

And the East Branch pair were fired two weeks after returning to their branch. Not because of the new frontend; somehow, that was Ricardo's fault. No, it was because in their absence, the East Branch CMS had broken severely, and people had realized it was a poorly written, buggy turd as well.

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!