Some horrible code is acres of awful, thousands of tortured lines of mess and horror. Some developers can compress their WTFs down into a handful of lines.For example, Zlatko was working with a Node.js developer who was big on unit tests. Unfortunately, that developer didn’t understand that you couldn’t write a synchronous test for an asynchronous method- the test will always pass.That’s why this code, buried in a callback, passed:
One day in winter, during that blissful dead stretch between Christmas and New Year’s, Chris was startled out of a deep sleep. He reached for his blaring cell phone, squinting at the painfully bright screen.
SharePoint. What can you say about it? Among other things, it's designed to help you manage and present content. It's supposed to make things easy for you. If you want some customization, just write some code to do whatever and configure it to run at the appropriate time for the appropriate page(s).Of course, this leaves open the possibility that folks who may be something less than experts might author said customizations.Paul is responsible for numerous customizations written by developers long gone from their project. One particular customization was to perform some clean up. At first, it was run once per day. Over time, that grew to running 8+ times per day on each of several servers.One day, the customization stopped working. Naturally, there was no record of it anywhere in source control (thank you predecessor coders).Having no alternative, the code was decompiled into the following loveliness:
Kevin L saw the program crash with a null pointer exception. This lead to digging through stack traces, logs, and eventually the commit history to figure out who was responsible.The code itself is a simple “string padding†function, the sort of thing that when people screw it up, you just have to wonder why. This variation on that theme, however, gives us that rare treat: an accurate comment that describes the function.
Every .NET programmer is familiar with the concept of properties. They’re a nice language feature, allowing the programmer to inject little bits of logic into the process of retrieving or setting the value of a field. A getter can, for example, lazily initialize a field when it’s first used, and a setter can validate the value before it’s set. Even a simple property with no logic beyond providing access to a backing field can be made useful by appearing in an interface or being overridden by a derived class.An important aspect of properties is that to the outside user, they appear almost no different from a regular field. As such, they’re supposed to behave like regular fields. Any visible side effects beyond what’s necessary are heavily frowned upon, and the developer who uses the property can reasonably expect it to provide transparent access to data from his point of view.KallDrexx’s coworker, however, was forced to deal with code made by people who didn’t seem to understand the “transparent†part– or, in fact, any part…
Ki and Morgan had an on-again, off-again relationship, but not because they couldn’t commit; Morgan was Ki’s dedicated recruitment agent at Impracticable Resources. Ki had to admit he left every other recruiter she’d dealt with in the dust. That’s why she was excited when he described the position at Initech: Ki had started as a web designer and migrated into Java development, and Initech was looking for exactly that to be the glue between their Java and UX teams. Eight short weeks ago, the initial phone screen had gone well.Gerard was Ki’s would-be boss’s name, and warned her straight away that Initech was procedure-friendly; every box on their list had to be ticked and accompanied by its own list of ticked box-ticking-assurance boxes, supplemented by a list of ticked box-ticking-assurance-box-ticking-assurance boxes before they could bring her on board.“I am very impressed by what I see,†Gerard said. “We want to bring you on-site, for our standard gauntlet of interviews. Sound good?â€â€œDefinitely,†Ki said. “When would you like me to come in?â€â€œWe’ll let you know,†Gerard said, “your recruiter will give you a call.â€Morgan did give Ki a call, almost three weeks later.“Ki, how’ve you been?â€â€œGood. Waiting to hear about the Initech position, I guess… You?â€â€œYeah, Initech. They seem really interested in you! Can you do Thursday afternoon?â€Ki stumbled out of Initech’s offices two-and-a-half hours after her arrival, exhausted but happy. Her interviews had gone extremely well. Gerard, who was head of the Java team, Celia, head of the UX team, and Armin, the lead designer, all agreed that she was at the exact nexus of design and development acumen that the job required. On the phone that afternoon, Morgan glowed to the extent one can glow via audio.“Ki, the job’s as good as yours!â€â€œThat’s great! Did they send you an offer?â€â€œWell… no. Knowing Initech, they’ll need you to come in again for a second battery of interviews. I’ll give you a call when they’ve been in touch.â€So that was that, for another three weeks.“Good news, Ki!â€â€œYou’ve got a lead on a company that hasn’t outsourced their hiring to a glacier?â€â€œEven better: Initech wants you to come in next Tuesday. Now, for this set you’re going to need a portfolio of previous work. You met Armin and Celia last time? Well, they’ll be grilling you on your presentation. That’s why I’m giving you all this notice!â€Ki looked at the past weeks sitting long and empty on her desktop calendar. “Uh, thanks.â€Gerard, Celia, and Armin were all glad to see Ki again, and somehow (perhaps because they had three weeks to prepare) they each had almost an hour of questions for her before her portfolio presentation. But she passed with flying colours and, on the brief tour of the office, Gerard apologized for the amount of time the whole process was taking. “If it were up to me,†he said, “you’d start tomorrow. But HR still wants to have a word with you, and the whole team is headed out West for the annual general meeting at Initech HQ. I’ll be sure to put in a good word for you with the bigwigs out there!â€Ki thanked Gerard and left. Soon after, she called Morgan.“So Gerard tells me good things!â€â€œYes, they seemed happy with me… again. But apparently there’s one more interview—did they mention when they’d be back from their visit to HQ?â€â€œLet me see… oh, yes, here’s Gerard’s email. Looks like you’ll be sitting down with HR on… hmm… uh, June 9th.â€â€œThat’s two weeks from now.â€â€œSure looks that way! Sorry, Ki. But this is going to be awesome once we’ve crossed the Ts and dotted the lowercase Js!â€And so Ki found herself up late on the night of June 10, having heard nothing from Morgan, Gerard, or Initech’s HR department. She was turning her mobile over and over in her hand, weighing her need to know against the possibility that Morgan, on the East Coast, would be asleep by now.“Hell with it,†she told herself, “if he didn’t want midnight phone calls, he should’ve gone into used-car sales.â€â€œH-Hello?†Morgan sounded groggy, but Ki held firm.“Hi Morgan, it’s Ki. I’m sorry to call so late, but I haven’t heard from Initech, and I’m wondering if they got in touch with you. I’m sure you understand that, after eight weeks, I really need to get some closure.â€There was a long pause on the other end, followed by a deep sigh. “…Ki, it’s… complicated. Really, I don’t know how this happened.â€There was that sinking feeling, the one that starts in your stomach and descends to places unmentionable. “How what happened, Morgan?â€"Well, I’ve got this email here from Initech HR. Apparently, in the wake of their annual general meeting at Initech HQ, it was decided that the role you’re applying for would be better suited to a less-technical candidate. I don’t know if they mean someone who just does web design, or what.“I’m really sorry about this, Ki. It sounds like you’re out of the running.â€â€œI don’t understand,†Ki said. “You’re saying they changed the job so I’m no longer a shoe-in?â€â€œI suppose that’s what I’m saying. Yes.â€â€œWell… okay. I’m sorry to hear that. Goodnight, I guess?â€â€œGoodnight, Ki…â€â€œOh, Morgan?â€â€œYes?â€â€œTry to find me a position in computer vision or compiler design next, okay?â€â€œHuh?â€â€œThat way, when they downgrade the position, I’ll be a perfect fit.â€â€œGoodnight, Ki.â€[Advertisement] BuildMaster is more than just an automation tool: it brings together the people, process, and practices that allow teams to deliver software rapidly, reliably, and responsibly. And it's incredibly easy to get started; download now and use the built-in tutorials and wizards to get your builds and/or deploys automated!
I'll be in London this week (Thus Feb 12) and Amsterdam next (Tues Feb 17), and thought it'd be a perfect opportunity for another The Daily WTF meet-up. Here's a pic from a previous year's London meet-up:
“I’ve got a gig for you,†said the recruiter.Clive, like many freelancers, weighed the contents of his bank account versus the daily rate he was promised, and decided that any gig was for him under those conditions. This one sounded mostly okay; an insurance company needed a new software package that would help them leap through some regulatory hoops. As a bonus, they wanted someone who could teach their devs the latest tools and techniques… like source control. Clive aced the interview, and started a week later. There was already an email waiting in his work inbox, from someone named Brandon. It read: “See me.â€That nose won't know what hit it…Brandon lurked in his office, adhered to his mid–90s ergonomic chair like it was an appendage. He glared over his monitor and stared at Clive. “You work for me,†he said.In monosyllables and four word sentences, Brandon revealed that no one who participated in the hiring decision would have any day-to-day contact with Clive. Clive reported to him, and him alone.“Okay… well, when I was hired, they said that they wanted me to set up Subversion. Should I get started on that?†Clive asked.“No.â€â€œMay I ask why? Do you have another preference? Would you like to discuss the options?â€â€œNo.â€Clive waited. Brandon didn’t expand. He simply stared at Clive. Stared, and stared.Clive slunk back to his cube and got started on looking at the code base. It currently lived in a file share, using the “file.pl.oldâ€, “file.pl.old.old†versioning convention. The code was Perl, and unreadable by even Perl standards. It had grown in a culture here “parsable means runnableâ€, included no comments, and had absolutely no tests. Clive’s only ally was Lee, another head-hunted expert who also reported directly to Brandon, and had a two week head start on understanding the code. When Clive got stuck, he poked his head around the cube wall and asked Lee.Like a glacier grinding down a mountain, Clive slowly worked his way through the code. After about a week, he was developing a small degree of confidence. Then an email from Brandon arrived: “See me.â€â€œYou’re disrupting the dev team,†he said.“What?â€â€œYou and Lee are making too much noise. This is an office, not a social club.â€â€œThat’s crazy. I’m just asking him questions about the work we’re doing! What, do you want us to schedule a conference room just to ask questions?â€â€œYes.â€Brandon stopped talking and resumed his staring contest. He stared, and stared… Clive got the point and scurried back to his cube.The requirements were complex and evolving, which wasn’t unusual. Only one user, Carole, actually knew what they were, which also wasn’t unusual. Clive sent her an email with a handful of questions, and tried to get some work done. He waited for a few days for her reply, and as he found new questions, he sent more emails.In a week, he had sent nearly half a dozen, but got no reply. He sent more, asking for status updates. Over this time, he had more questions. He tried calling her, but it dumped to a full voicemail box. He tried scheduling a meeting, but Carole never accepted.And then an email from Brandon arrived: “See me.â€â€œCarole says you’re harassing her,†Brandon said.“What?â€â€œYou send her emails, even after she answers your questions. She said you called a meeting but didn’t show up for it. This needs to stop.â€â€œThat’s crazy. She never replied, and I can show you my inbox to prove it.â€â€œCarole doesn’t use email,†Brandon explained. “An intern prints out her emails, and she replies via inter-office mail. She’s very busy. You have the requirements document. Implement it, and stop bothering her.â€â€œWhat, you want us to implement a solution without ever talking to the business user who knows the requirements?â€Brandon stared at him. And stared. And…With Lee’s help, Clive made some real progress over the next few months. They learned their way around the absurd date format (measured as the number of days since April 3rd, 1974, except when it was measured in the number of months since the preceding Monday, except when it was measured in the number of weeks since the following Sunday). They worked past the fact that no one was allowed to upgrade past Firefox 3, or the fact that they couldn’t run overnight jobs because all of the servers were turned off at 6PM sharp. Carole didn’t communicate, Brandon just stared at them, and the rest of their co-workers treated them like plague carriers.A few weeks before their six month stint expired, Clive was digging through the company network drive, searching for a spreadsheet containing sample data. He found one named after the recruiting company that placed him, and hoped that it was something useful. It was, after a fashion.The spreadsheet was a report illustrating exactly how much the recruiting company was getting paid to provide Clive and Lee. The fees were so abusive a used car salesman would have blushed. Change tracking and collaboration was enabled on the document, which meant Clive could read comments made by various users.From the senior management level, there were comments like, “It doesn’t matter how expensive it is.†Accounting warned, “We won’t have the money to pay annual bonuses, if we do this!â€Brandon had left his own note: “Our business is too special. They will fail. This is a waste of money. They will fail.â€The pieces clicked into place. Brandon hadn’t been making a prediction; he was making a promise. And he’d kept it- there was no way that Clive and Lee could deliver what was originally promised in the next few weeks.Then an email from their recruiter arrived. “That company still wants added staff. Do you want to re-up for another six months?â€Having learned from Brandon, Clive sent a one-word reply: “No.â€[Advertisement] BuildMaster is more than just an automation tool: it brings together the people, process, and practices that allow teams to deliver software rapidly, reliably, and responsibly. And it's incredibly easy to get started; download now and use the built-in tutorials and wizards to get your builds and/or deploys automated!
When most folks create something, be it carved, welded or coded, they take pride in what they're creating. It's a reflection of their soul. It's personal. They care.However, once you tell someone that their stuff will be in or on something that is someone else's responsibility (aka.: problem), they often take less care in what they're putting there.To me, the phrase The Cloud can be safely replaced with Someone Else's Computer in every conceivable context; load-distribution; storage; file transfer; etc.As such, all too often, when something is to be in/near/on/associated-with any-or-all-things-cloud, the folks who build it tend to do somewhat lower quality work.Ayken recently inherited an old website that quickly turned out to be a management nightmare. Every veteran who is used to fighting such ancient demons knows that every PHP project comes with ridiculous stuff like this trim-function that was clearly written in complete ignorance of the existence of regular expressions: