Feed the-daily-wtf The Daily WTF

Favorite IconThe Daily WTF

Link http://thedailywtf.com/
Feed http://syndication.thedailywtf.com/TheDailyWtf
Updated 2024-10-05 02:16
CodeSOD: Sorting Cabinets
Sorting. It’s a well-studied class of problem, with a number of well-understood solutions. These days, pretty much any time you need to sort a collection, there’s a language-or-framework-provided function that handles it for you. Sure, a Better Idiot™ might try and implement their own sorting algorithm from scratch, but your Regular Idiot™ just has to call .sort- it’s Idiot Proof™, rightWell, David S. found a better idiot.
Registered Students
Tim C. took pride in his work. He debugged Clockaburra, a timetabling and management suite, used in Australian high schools. Oftentimes, it was a simple problem that could be reproduced after a quick phone call from a client- usually a vice principal or the secretary. It’s when a bug can’t be reproduced that things get tricky, but Tim had the solution for that as well.One day, he got a call shortly after lunch from a Mrs. Harriet, the vice principal of Charles Perkins High School. “All of our mathematics classes have disappeared from the schedule,” she said. “It just happened this morning.”“What was the last thing anyone did to the schedule before the error?”“Oh, I wouldn’t know,” Mrs. Harriet said. “There’s a few of us who use it. It could have been anything, really.”This was, of course, the worst-case scenario. Tim had to go with Plan B. “Okay, I’m going to need part of your registry tree.”Step-by-StepStandard procedure of quality assurance is to recreate the reported environment as closely as possible, then isolate all the variables which could cause the issue until you find the root cause. Due to Clockaburra’s architecture, the easiest way of recreating the user’s environment on his machine was to get the client to send him the registry tree for Clockaburra in a .res file.“Oh, I’m not sure I could do that,” she replied. “I wouldn’t know how.”“Oh, it’s easy,” Tim said. “I’ll walk you through it.” Although it nearly broke his stress ball, he managed to guide Mrs. Harriet through the process. Then he walked her through attaching the file to an email, which was a bit of a puzzle for her. The email arrived, titled, “VERY IMPORTANT FILE”, with a .res file attached. The file was a surprisingly large 5MB, but Tim assumed they must just have an unusual installation on their end. He updated his registry with that file and rebooted.Identity CrisisTim blinked. His screen displayed a login that read Charles Perkins High School. Above that was an image of Charles Perkins in his football kit. He tried his credentials and was met with an “Invalid Username” error.His phone rang. It was Mrs. Harriet, who was eager to get all of those mathematics classes back on the schedule.He laughed nervously. “It’s… uh… well underway,” he said. “I’ll get back to you with a full report once we have it fixed.”Things not well underway, it was his turn to call his tech support, Bennelong.“This is a first for me,” BEnnelong said, after taking one look at Tim’s new login screen. “What did you do last?”“I was updating my registry with one a client sent. She sent me the tree for Clockaburra which shouldn’t have-”Tim remembered that the .res file Mrs. Harriet had sent was a chunky 5MB. She had sent her entire computer’s registry, not just for Clockaburra. His computer was tricked into thinking it was hers.Academic DiscretionBennelong used System Restore to get Tim’s system back to just before the call with Mrs. Harriet. Tim isolated the Clockaburra registry tree in the file, and soon pinpointed the issue as some invalid settings. Mrs. Harriet- or someone else- had blindly mis-configured the application in the most creative way Tim had seen yet. He returned Mrs. Harriet’s phone call late that afternoon with instructions on how to fix the problem.“That took quite awhile,” she said. “Nothing serious, was it?”“It was more of a snafu on my end,” Tim admitted. “I actually had to call tech support to get me out of a jam. I’m very sorry for the delay.”“Well, I won’t tell if you won’t,” Mrs. Harriet said. “We all have our moments.”[Advertisement] Release!is a light card game about software and the people who make it. Play with 2-5 people, or up to 10 with two copies - only $9.95 shipped!
CodeSOD: The Coercive Types
Loosely typed languages may offer certain advantages in terms of ease of use and flexibility, but they bring another challenge: it’s difficult to know what it is you’re looking at. With no compiler type checking, it’s hard to compare two things, and that becomes extremely problematic when you’re working with languages like, say, JavaScript.Ruby, in its quest to “make programmers happy”, took a simplistic approach to the Truthy vs. Falsy problem. False is false. Nil is false. Everything else is True. Ruby is often used by web developers, who may be more comfortable in languages like JavaScript and PHP.That is presumably why Lisa found this debacle in her code base, placed there by a co-worker who preferred other web languages:
The Graduate
Management will frequently hire young developers just out of school because a) they're cheap, and b) a developer is a developer is a developer. Graduates, especially from advanced degree programs, always have more advanced training than those with lesser degrees, and should be able to bring advanced skills to the table on day-1. Sometimes management gets lucky, and with a bit of proper guidance and oversight, the newbie can create something reasonably functional, performant and maintainable. This is not one of those occasions.In the aftermath of that strategy when management realizes that perhaps something is amiss and the usual threats of get it done don't seem to work, management crowbars open the purse strings and highly paid consultants are often sought after to clean up the mess. Sometimes the consultant can fix the mess. Sometimes the power of management to $*#%& up a project far outstrips anyone's ability to fix it.Jenny was lured hired to make some minor modifications to speed up a system of the latter variety that was written by an unsupervised fresh-out. It was way over budget, behind schedule, full of bugs and not feature-complete. The customers were not happy campers, and were not bashful about expressing their outrage dismay at the cost and progress. Basically, just another day in the office for Jenny.The application itself was run-of-the-mill case management software, storing basic demographic information about clients, the people that referred them and the history of their cases. It's a SQL Server database with ASP.NET forms to interact with the data. It should have been pretty simple stuff. Except...The design documents were literally coffee-stained napkins and Jenny was forewarned not to discard them. There had never been a DBA on the project. Naturally, this led Jenny down the rabbit hole...One of the first things she encountered everywhere was that columns that stored Yes/No data were declared as VARCHAR(20), and stored the literal strings "Yes", "No" and a variety of things that conjured up nightmares of FILE_NOT_FOUND.The application also had a number of data fields where the user must select a value from a pre-determined list, and the list is stored in the database. That is, there is a list of Suburbs, a list of PostCodes, a list of Illness types, etc. Rather than have tables called Suburbs, PostCodes and Illnesses, the developer opted for one table for all of them (interestingly, the booleans were not stored here, and commanded their own dedicated table). The table is called RefData_5, and whenever you want the data for any list (e.g.: the list of suburbs) you have to select from that single reference table and filter to get the records where RefType is "Suburb"). To complicate things, the table contained constant string values, numeric postal codes and enumerated values. Thus, once you queried the data, you needed to explicitly convert it to the correct type before you could use it.Of course, prior versions of the table still existed: RefData_4, RefData_3, RefData2 and RefData_1. Unfortunately, they weren't just there as unreferenced remnants. Some of them were referenced here and there throughout the code base and stored procedures, which led to all sorts of instability as table definitions changed over time.Adding to the woes, the code was not stored in any source control system; Jenny was handed the good copy on a USB key.Just to make things interesting, once a constant had been identified as applying to a particular situation, the PK of that constant record was not stored in the foreign record. Instead, the constant literal and the single character key (e.g.: "12345" and "P"ostcode) were stored. Of course, you had to ensure that you never used the same key for two different data types in the REF_DATA_n table, or going the other way might become an interesting challenge.Perhaps most impressive, is that the graduate managed to write queries on this structure. They were hundreds of lines of T-SQL if-else's and ran, well, glacially, and mostly returned the correct data. Mostly. So now Jenny gets to explain to management why their system that was inexpensively developed by the graduate ran so slowly and inconsistently, could not simply be tweaked to make it faster, and that a full rewrite was in order; all to hear in return: you're a highly paid consultant and you can't fix it?! Why are we paying you?[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!
Error'd: Blah, blah, blah!
"Believe it or not, I've actually seen less helpful content on StackOverflow," Luc F. writes.
Power Trip
It was a hot, cloudless summer day outside the headquarters of SmallTown SoftCorp. That didn’t matter much to Neil though, as he basked in the frosty air conditioning of the company’s modest, self-owned building. During the building’sconstruction, Neil oversaw the installation of everything from the demarc to the HVAC system. This made him feel like he had a hand in the arctic clime of the office.Those nice cool thoughts were torched when the power in the whole office suddenly went out. A chorus of profanity could be heard as all of the developers who hadn’t saved their work in a while lost everything. People began to stumble out of the windowless meeting rooms that had become blackened employee traps. “What the hell is going on?!” Jack, SmallTown SoftCorp’s owner, bellowed from his dim office. Jack slowly felt his way to Neil’s desk. “Neil! You know how this building is wired better than anyone! Get the power back on NOW!” Jack commanded, sweat beginning to form on his brow without the air conditioner combating the heat.Neil had to bite back an “I told you so!” During the construction, Neil stressed the importance of a backup diesel generator, but Jack shot it down as an “unnecessary luxury”. Thankfully, he was allowed to purchase UPS’s to keep their mission-critical servers alive. Neil got out his cell and phoned the utility company. The automated voice was happy to tell him there were no outages in the area. He deduced the problem must be isolated to their building.Neil grabbed a flashlight and headed to the pitch-black bowels of the building. He flipped the main breaker on and everything in the office sprung back to life. “Easy enough,” he said to himself. But the real problem would be figuring out why this happened. He looked around, all the wiring seemed to be intact. There were no signs of a cooked mouse that bit down on the wrong cord. He decided to check with everyone around the office to see if they noticed anything strange.He got several stock “I was working hard and everything went black!” responses. Jack said he was on an important call with a customer, but a check of his internet logs would probably show he was wasting time on Twitter again. As Neil approached Mike, one of their framework developers, he got visibly flustered. “Hey Mike. Did you notice anything happening before the power went out?”“What? Me? No! Of course not! Why would a lowly programmer as myself know anything about a power outage?” Mike replied with a nervous chuckle. “It sure is cold in here though! My cubicle feels like an igloo.”Neil looked up and noticed Mike’s desk was directly under an air conditioning vent. “Ouch, looks like you got the cold spot! Try to think warm thoughts.”Neil went back to Jack’s office to report the bad news that he didn’t have a root cause for the outage. Jack used his electrical knowledge (or lack thereof) to determine the air conditioning must be sucking too much juice on a hot day. “Turn the AC down immediately, Neil! We can’t have this happen again.” Neil obliged by setting it a few degrees higher and went back to his normal business.Later that afternoon, Neil was working on documentation when the office again went black. “OH COME ON!” a frustrated programmer shouted from across the office. “NEIL! I SAID THIS CAN’T HAPPEN AGAIN!” Jack roared out like a lion in the darkness.“I’m on it, Jack!” Neil replied, frustrated. Luckily he still had the flashlight on his desk and the power was back on in a jiffy. He knew telling Jack he didn’t have an explanation wouldn’t fly this time, so he would not rest until he found the culprit. Of course, there was no obvious cause. Neil searched the building top to bottom, and couldn’t figure out the cause. He swore to figure it out the following day.The next day was the hottest of the day of the year, and Neil dreaded the load the HVAC system was putting on the electrical system- and sure enough, the power went out again. Jack shouted his anger, and Neil scurried off to the basement to fix the problem. With the lights on, as he came back up to the top of the stairs, Neil spotted Mike trying to sneak out the side door with a large object.“What you got there, Mike?” Neil asked with suspicion.“Oh, um, nothing,” Mike stammered, as he turned towards Neil with a large space heater in his hands. “It’s just that it gets so damn cold by my desk, I decided to bring this heater in and, it’s probably just a coincidence, but when I do this…” Mike bent down to plug the heater in a nearby outlet.“Mike, NO!!!” Neil couldn’t stop him fast enough as the heater fired up for a split second before the eerie quiet of a power outage returned. “You fool! You can go explain to Jack why the power keeps going out while I go back to the stupid basement.”[Advertisement] Scout is the best way to monitor your critical server infrastructure. With over 90 open source plugins, robust alerting, beautiful dashboards and a 5 minute install - Scout saves youvaluable engineering time. Try the server monitoring you'll 👍 today.Your first 30 days are free on us. Learn more at Scout.
CodeSOD: Taking Exception
Like many enterprise organizations, Martin’s workplace decided that they needed to build a collection of .NET assemblies which would be used in every application they built, and would provide important facilities like error handling.And of course, not only would every application need to use these libraries, every application needed to make use of every component in them, otherwise why have the libraries at all? This meant that every Exception thrown by the application needed to inherit from the BaseException class:
Sharked
Andrew M. worked at a small company in Kansas City called EtherTrode. With one facility and about 20 employees, they designed and built custom Ethernet hardware and drivers to fill niche roles where the common integrated chipsets weren’t good enough. Their hardware worked quite well, which attracted the attention of a multinational conglomerate called Initech. Initech puchased EtherTrode, rather than develop their own Ethernet devices.Like most others at EtherTrode, Andrew was a jack-of-all-trades. On any given day, he might be doing anything from customer support, to application development, to general office IT tasks, and even once a bit of soldering. It was the general office IT tasks that got Initech’s attention: he was selected to work with Initech on integrating their networks.The first phase went more-or-less smoothly. Initech shipped Andrew a pre-configured Cisco router, and instructions on how to connect it. After a weekend of integration, EtherTrode’s network now had a permanent VPN tunnel to Initech’s headquarters in Detroit.Phase One was boring. Yes, there were minor screwups and a few WTFs due to some miscommunication and unnecessary outsourcing, but that’s a variation on the same story that’s been told a million times before. Phase Two, however, was the Grand Slam over the foul line, lightning in the whiskey warehouse, the Cheese Shop without cheese, and a painful urination upon a subway’s third rail…… Active Directory Integration.Once the networks were connected, Initech wanted to terminate EtherTrode’s Active Directory domain and move all of their accounts and systems into Initech’s domain. Contractors working for Initech prepared a new domain server and shipped it to Andrew. He received the system, racked it the next weekend, and powered it on. Everything seemed to work, and local systems joined to Initech’s domain without issues. Come Monday morning, the office was ready to resume business.Things turned sour around lunchtime on Monday. All morning, employees had complained about poor network performance. Their emails failed to send, and new messages failed to arrive. Tiny Subversion check-ins would fail more often than not, and even internal web pages took minutes to load- if they loaded at all. Worse still, Initech’s security officers had installed a new electronic lock system on EtherTrode’s building, which was connected to the LAN. By lunchtime, the locks refused to unlock, and Andrew had to physically unplug the controller unit in the server room to disable the lock so employees could actually enter and exit.The core staff of EtherTrode had an impromptu meeting shortly after lunch to discuss the issues. Lyle, another engineer, arrived late. “But I know what the problem is,” he explained.“I noticed the lights on our core switch were blinking like a strobe light in a tornado, so I fired up Wireshark.” A few of the engineers nodded, and Andrew wondered why he hadn’t thought of that. EtherTrode made Ethernet equipment, and Wireshark was an invaluable tool for examining the behavior of their devices and networks. It was the best way to make sure their hardware complied with Ethernet and TCP/IP standards, and it was really good at not interfering with their network while doing its monitoring. “In short,” Lyle explained, “there’s a device at 192.168.16.245 that’s issuing tens of thousands of broadcasts per second. The switches are dropping frames, and the IP stack on everyone’s workstation is working overtime processing irrelevant packets.”“254, you say?” Andrew said. He frowned. “That’s the IP address of our new domain server…”“Can we shut it down?” asked Ryan, their boss. “Rollback to how our network was last week?”Andrew shook his head. “I’ve already joined everything to the new domain. If we shut down the controller, no one will be able to log in or access network resources… not that they can now.”Lyle spoke up again. “The traffic looks pretty fishy. I think the server’s got some sort of malware on it. Can we log in and see what it’s doing? Run an antivirus or kill the process?”Andrew shook his head again. “Initech has it locked down tight. I can do some basic domain admin tasks, but I can’t actually log into the server.”“Alright,” Ryan said, visibly irritated, “Lyle, give me your Wireshark capture. I’m going to go down to the coffee shop for their wi-fi, and I’m going to forward it to Initech and raise some hell.”In the meantime, Andrew and Lyle went back to the switch. Since the broadcast was on a single port, they blocked that port at the switch. The server kept shouting its head off, but now the switch dropped the packets. Doing anything that required talking to the domain server- like logging in- was painfully slow and failed half the time, but the rest of the network worked fine. That bought them some time while they waited for a better solution from Initech.The next day, Andrew came in, grabbed a mug of coffee, and picked up the top priority support ticket. This one was a customer support issue. They had uploaded their own Wireshark capture to an FTP server. Andrew downloaded it so that he could see why their EtherTrode equipment was misbehaving. When he went to open the capture, Wireshark refused to start- or more accurately, it was no longer installed on his system.“That’s strange,” Andrew thought to himself. Maybe a Windows Update messed up the registry settings, or something, so Andrew redownloaded Wireshark and ran the installer.Or tried to. The installer refused to run. “This publisher has been blocked by your administrator,” explained the error message. As if on cue, his email client dinged and he was a new memo from the Initech IT department:
CodeSOD: Filter Overflow
Onboarding was complete, and Denise finally had her PC. Time for her first assignment!"It's really pretty straightforward," her new boss had said, with a resigned look in his eye that betrayed it wasn't actually straightforward. "Your predecessor almost had this new CMS complete, we just need filtering on the frontend search."It wasn't glamorous, but it was probably a good way to get her feet wet in a new organization. The requirement was to fetch a list of image IDs that corresponded with a business ID so that users only saw the images for their group. Simple, straightforward, obvious. She had it done inside of a few days and sent to the users for UAT.And that's when the change requests started."Can you make it filter by state? Like, hidden images, public images, that sort of thing?" Sure, easy enough."What about filtering by upload date? Like if I gave you a date range?" Um, sure, but it'll add to the time...Even after the filter was in production, the list of requests kept rolling in, bypassing the helpdesk and going right to her email inbox. "We're getting a lot of spam images, can we filter so only verified users' uploads show up?"Denise's boss told her it'd be over faster if she just gave in and made the change. Management would ultimately decide to do it after wasting her time with meeting after meeting to discuss priority anyway."Can we put videos in the CMS?""Can we filter by tags?""I need to filter images that are actually images.""Can we sort on the tags?” How do you sort on tags? Denise wondered. Apparently, by their business IDs. Sure. Whatever."I'm still getting images that shouldn't be showing up. Can we filter for only images that show up?""There's too many images, can I limit it to ten per ID?"Finally, she ended up with this giant Ruby monstrosity:
Error'd: See Something? Say Something!
Patrick wrote, "I was at Penn Station in NYC, and, well, I just had to say something!"
The Depths of Insanity
George G. came to the Pierce & Pierce office in good spirits and with high hopes. After finally gathering the courage to run away from his previous job, which had involved maintaining a million-line, 15-year-old mess of a codebase, he'd spent the last month interviewing with nearly every tech company in his area. Here he'd found his Promised Land: a modern-looking, professional company with a suite of cutting-edge technologies and, most importantly, a new and interesting project to which George would be assigned.Or at least that was what Pierce & Pierce had promised at the interview."Well, you see, there's been a reorg." George had barely sat down at his desk for the first time when his manager brought him the news. "All new projects are on ice. We're gonna be putting you on our flagship product instead. Don't worry, we'll have something real cutting-edge for you soon!"Flagship product? That could only mean one thing: legacy code. Another aging codebase which, thanks to the company's "innovative performance-boosting management methods," clocked in at five million lines of uncommented, undocumented code. As much as George wanted to get up and leave at such news, he decided to bite the bullet and give Pierce & Pierce a chance ... for now.He received his first assignment almost immediately. The application failed to read a particular line from a config file, and the task was to investigate and fix the issue.Well, that should be simple, he thought. I just need to find the place where the config file gets opened, then there should be some loop that reads it and looks for that line. Easy-peasy.He submitted a one-hour time estimate, giving himself some leeway, then got down to hunting the bug.Unfortunately, things weren't so simple. What was supposed to be a quick, introductory trip through the codebase turned out to be a strenuous excavation through layer upon layer of abstract factory builders, inline lambdas spinning off separate threads, callbacks to callbacks, and other examples of architecture astronautics—all to simply read the configuration file.Four days later, George managed to find something resembling an error logger. He set a breakpoint and ran the application, hoping to work his way through the call stack to where the issue lay.Sure enough, the breakpoint was hit almost immediately. But even before George started reading the stack trace, he knew it wouldn’t be of much use. The list of classes looked something like this:
Bring Your Own Code: The End of the Lucky Deuce
What feels like forever ago, we introduced the Lucky Deuce casino contest. This is a series of challenges, brought to you by our pals over at Infragistics, where we call on you to help us build a “scoundrel’s casino”.Last week, we introduced our final challenge: take one of our casino games, add a betting system, and then build a strategy that lets you keep playing (by distributing the load across multiple accounts).Once again, we had a nice pile of great submissions, and there are two who are going to get to take home a nice TDWTF hoodie for their troubles. As always, check out the full projects on GitHub.For all of our winners (from this week or any previous)- or anyone who entered using Infragistics controls- expect an email in the next week or two to follow up about how best to get you prizes.WinnersFirst, let’s talk about Bruno’s solution. For bonus points, he decided that his system should be able to detect a user’s gender by their name:
'Tis the Season
Deep in the wooded vales of red state America, December is hallowed not just for hunting presents, but also hunting deer. Lo, the season opened on a Friday. Clayton’s consulting firm declared it Camo Day in celebration.Employees festooned themselves and their office in their brown-and-green finest. Some posted deer horns and small taxidermic animals in prominent locations. While this particular company stopped short of installing a shotgun in the kitchen, just in case a bear happened along, it was still the most redneck of wonderlands.Clayton could even swear he smelled hunting musk as he moved through the floor, trying to get back to his desk after an exhausting code review. And everywhere he looked, camouflage-print duct tape lingered like traces of scat: patching a hole in the carpet, propping up the back of a swivel chair, cradling a leaky ceiling tile …Both tape and musk led to his manager Buck’s office.“How you doin’, Clayton!” His voice boomed out from the office like a blunderbuss’ payload, halting Clayton in his tracks. “How’d that code review go?”Clayton peeked in to find Buck applying a piece of camo duct tape to a patch of ruined drywall behind his desk chair. He ignored the scene to reply, “Fine. John has some changes to make, but nothing major.”“Good, good.” Buck rubbed a fist over the newly applied tape. “Don’t mind me, I’m just taking the initiative to fix a few things around here.”Clayton debated whether to say anything. In the end, he couldn’t help himself. “Uh, all that stuff you’re fixing probably needs more than duct tape.”This prompted Buck’s ringing laugh. “If you can’t fix it with duct tape, you’re not using enough!” Finished with the wall, Buck turned, yanked his laptop out of its docking station, and began wrapping the camo-colored tape around it.Clayton really knew better, but again couldn’t help himself. “What are you doing?”“Decorating my laptop!” Buck replied.“But … you’re covering the vents,” Clayton managed around his shock. “It’s gonna overheat.”“It’s winter and it’s cold out! This thing’ll be fine.”“Win—you’re taking it outside?” Clayton faltered.“Out to my hunting blind! I’m cutting out early to get a jump on the season.” Buck reached into his pocket. Out came an obnoxiously sized lock-back knife that he used to slice a gap into the tape layer, allowing him to open up the laptop.“Why bother working remotely?” Clayton asked. “Just call it a week.”“The usual BS quarterly meeting is this afternoon—of course.” Buck rolled his eyes. “Gotta join the WebEx and at least pretend to pay attention.”The WebEx would handle both video and audio for the meeting. Clayton imagined the deer would take a dim view to budget projections, but Buck’s laptop did have a mute button.“Happy hunting, champ! I’ll have my cell phone in case you need anything.” Buck packed his laptop, then gathered his coat and a cooler that was almost certainly full of beer.“Uh, OK.”In the end, Clayton couldn’t complain about a manager-free afternoon. He returned to his desk, dug into his work, and all was well.A few hours later, his desk phone rang. Buck’s cell.Clayton internalized a curse and picked up the phone. “Hello?”There was nothing on the other end at first aside from scuffling, and a string of very not-internalized curses from Buck.“Boss?” Clayton prompted.“The damn thing’s a brick!” Buck cried.“What is?” Clayton asked.“It just shut down on me!”“Your laptop?”“And the damn meeting’s still on!” More scuffling noises from Buck’s end. “Hopefully everyone’s too busy snoozing to notice I fell off the WebEx. Hang on, I’ll be in the office soon!”Clayton didn’t bother stifling his groan, but managed to hang up before it escaped.Twenty minutes later, Buck stampeded into his cube, cooler and laptop in tow. He dropped the camouflaged computer onto Clayton’s desk, shaking out his hand. “Sumbitch shut down on me out of nowhere!”Clayton felt the waves of hot fury radiating off the laptop when he stuck his hand near it. “It overheated, like I said. You blocked the fans that keep air circulating through there,” he explained. “We gotta get this tape off.”“Nah! If it’s hot, we just gotta cool it down, right?” Buck opened up his cooler and pulled out a half-melted bag of ice. He then turned and dropped said bag directly onto the laptop.Clayton’s jaw fell. Should he bother to say anything? No, it never helped.“While it’s cooling off, I’ll need your computer to log back into the WebEx,” Buck said.Clayton suppressed his instinctive panic. “You have to leave it here. No ice or camo. I’m done for the day, and I’m not touching any more work until Monday! Deal?”“Deal.”With a collecting breath, Clayton logged out, then stood to gather his belongings. “There you go.”Buck clapped him on the shoulder. “Happy hunting, champ!”[Advertisement] Scout is the best way to monitor your critical server infrastructure. With over 90 open source plugins, robust alerting, beautiful dashboards and a 5 minute install - Scout saves youvaluable engineering time. Try the server monitoring you'll 👍 today.Your first 30 days are free on us. Learn more at Scout.
Classic WTF: The Non-Deleting Delete
It's a holiday in the US today, which means we're taking a 3-day weekend to dig back through the archives and find a classic WTF. One of my favorite features- one that we run far too rarely- are the true confessions. Sometimes, we are TRWTF, and let's applaud Matthew Schaad's story about his misuse of database triggers. - RemyIt started out as an average day for a developer like me. At 11:30AM, I was just getting into the office and fixing my second cup of coffee for the day. Being in the habit of coding till 3:00AM nightly, I was averaging about three to four cups a day. As I sat down at my desk to tackle one the several projects I had been assigned, I got a frantic call from the Director of IT, Jeremy.“Matt!” the telephone receiver shouted.“Yes?” I responded coolly, as I was used to hearing about fires that needed to be put out yesterday.“The reservation system is not allowing users to delete their reservations! Martin booked a conference room every Thursday for several years out, and now he can't delete it. Can you take a look at it?”“Sure, no problem,” I replied before hanging up the phone and going back to sipping my coffee.Jeremy was referring to our company reservation system. Similar to Outlook, we use it to manage shared resources, such as conference rooms, company cars and IT equipment. It isn't the most reliable system, and we constantly get complaints about it. Most of the time, though, the problems seem to arise between the chair and keyboard.So having gotten my marching orders, I opened up the database, wrote a quick DELETE statement, ran it, and saw that it deleted all the records for Martin’s recurring appointment:
Error'd: Crotia? Slovania? DO NOT USE!
"Canada? Yes! At least they got that one right!" Steve M. writes.
The Wunderkind
Software needs to run quickly. Whether it's to get a response to a shopper so they don't get bored and click on to the next site, or performing calculations on some data that is urgently needed downstream. Efficiency is important!To that end, most developers attempt to write code that runs quickly. Sometimes, the code needs to run more quickly than conventional means will allow. In those cases, smart developers will figure out how to game the system to get the computer/network/disks/etc. to get things done more quickly than the usual methodologies permit. For example, you might try to cut network overhead by stuffing multiple small requests into one buffer to take advantage of the leftover space created by network packet sizes.Of course, if you're going to do something sophisticated, it's common courtesy to document what you're doing, and why, so the next person who has to maintain your code will know how to proceed.Unfortunately, not all developers are smart, or considerate.Ralph worked on a mature Java/C++ project that needed to replace an even more decrepit mature reporting system. After several half-hearted starts, his company bought a competitor that had a pretty decent reporting system that was written and supported by The Wunderkind.The Wunderkind convinced management that the reasons that he was so successful were that:
Bring Your Own Code: Getting Comped
Today brings us the fifth and final entry about the Lucky Deuce. This is a series of challenges, brought to you by our pals over at Infragistics, where we call on you to help us build a “scoundrel’s casino”. Read to the end, because this week's challenge has a bigger prize- some TDWTF-emblazoned hoodies for the best entries.Last week was your first shot at a “straight” solution, and the entries really showed it. Pretty much everybody got straight into the problem.Honorable MentionsRobert for example, implemented his solution as a straight-forward WinForms application in C#. What gets him his credit is… interesting extension to a simple die class he wrote which helps him count die combinations later:
CodeSOD: Byte me
The great thing about Android is the low barrier to entry: thanks to open-source tooling, emulators, and the decision to build on a language often taught in schools, just about anyone can write a simple little app.The worst thing about Android is the low barrier to entry. Just about anyone can write a simple little app, whether they know what they're doing or not. The following code snippet is intended to take bytes from an InputStream (a common paradigm for web in Java) and save them into a file.
Enlisted
After a 6-year enlistment with the United States Air Force, followed by a 4-year degree in Computer Science (paid for by “Uncle Sam”), Tony S. joined with a small company that specialized in criminal background checks. “No more unpaid overtime!” he’d thought to himself upon joining the civilian world for the first time since high school. “No more screaming officers! No more sleepless nights from trying to meet deadlines!”Tony quickly noticed his new employer had efficiency problems. They tracked everything the company did in an Excel/VBA monstrosity that had been cobbled together. Wanting to show initiative, Tony suggested that he could build a database-driven website to replace it. His boss agreed, and they drew out a three-phase plan to implement and deploy his idea.Phase 1After a month of design and development, Phase 1 was well underway. Tony had written the basic data-layer for the application. It didn’t have many features, but could easily show some of the company’s in-progress projects he’d manually imported from the toxic hellstew of spreadsheets. Pleased with his progress, he scheduled a meeting with his boss and the data leads to demo it.During the demo, his boss cut him off. “Who authorized this project?” she interrupted.Tony paused. Did she not remember helping him plan it all? “I… um… uh… you did.”“I did no such thing. How long have you been working on this?”“About four weeks now,” he replied, acutely aware of the burning sensation on his cheeks as his boss grilled him in front of everyone. “You helped me pl…”“We can’t have our employees spending this much time on unapproved projects!” she yelled.The meeting got worse from there. In the end, his boss relented, but declared that Phase 2 and Phase 3 would never happen. In addition, she gave him a list of features that had to be delivered by the Phase 1 deadline- a list that conveniently included everything from Phases 2 and 3.Phase 1, Part 2Tony tried to continue on the project, but now that his boss was involved, requirements constantly changed. One day, he was asked to add in a full-fledged help-desk ticket tracker, and the next day he was asked to rip out the third-party helpdesk library he’d integrated because it was a “security risk”. His boss demanded that it be implemented from scratch, and refused to budge on the deadline.“That’s not enough time!” Tony complained.“It will be,” she said, fixing him with a stare so cold it could freeze Hell. “Or you won’t be working here anymore.” With a wave of her hand, she dismissed him.Tony soon found himself working 15–16 hours a day, 6–8 days a week, trying to meet the deadline and keep his job. He worked hard, but the hours took their toll. Life left his eyes and he slowly decayed into a zombie which smelled strongly of coffee.Phase 1, Part 3…ish?Two days before the deadline, Tony completed the last of the requirements. The application was buggier than a roach motel, but most of the issues could be worked around and fixed later. He headed home, though he didn’t remember it, and passed out. He’d only had about 3 hours of sleep in the past few days. Simple concepts, like sleep, time, and food, and sleep, and lists were now only vague memories he couldn’t quite grasp anymore.He woke to the buzzing of his cellphone. The clock read 1PM, and the caller ID was for his boss.“Why aren’t you at work today? Tony, this is unacceptable! I can’t have lazy employees skipping out on work! I am going to have to discipline you, and this is going in your file. Get to the office RIGHT NOW!!!”Enough was enough. Tony didn’t rush straight to the office. He spent the next ten minutes typing up his resignation letter. Then he went to work. As soon as he entered his boss’s office, she launched into a new round of screaming anger. “You are the worst employee I’ve ever had! You invent make-work projects, you come in late. Look how late it is! Don’t think I didn’t notice you leaving early and taking long lunches! There’s only one response for this inexcusable pattern of unprofessional behavior- I have to fire you! Stay here for the rest of the day and get your stuff sorted out, and I’ll arrange for HR to…”Tony mentally phased out at that point. He dropped his resignation letter on her desk, turned around, and walked out. He paid no attention to the shouts that grew louder as his boss became more inflamed from this apparent insubordination. As he left the building, he considered re-enlisting. Maybe scrubbing toilets with a toothbrush at oh-dark-thirty while getting screamed at by a drunk Second Lieutenant with an ego problem, after a double-shift of guard duty, wasn’t so bad after all.[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!
Error'd: Political Errors
"I agree, Google. When it comes to news coverage of politically sensitive topics, many errors have occurred," writes Scott.
No Changes Please
A new codebase at a new job is a lot like a new relationship: everything’s great until you really get to know each other. Just ask Bradley, who joined Javatechsoft Industries a few months ago. He was brought on to lend a hand with an overdue project. The pay was good, the job came with life insurance, and he had plenty of experience with Enterprise Java. It seemed like the perfect fit.Specs came in, Bradley shipped code out, and their honeymoon was smooth sailing. The bad things crept up slowly, poking their heads out of the code in funny little ways that didn’t seem like a big deal, they were kind of cute, until…
Bring Your Own Code: A Fever on a Crappy Day
It feels like forever ago, we introduced the Lucky Deuce casino contest. This is a series of challenges, brought to you by our pals over at Infragistics, where we call on you to help us build a “scoundrel’s casino”. We are nearing the end of this little BYOC contest- this week is our last "all original" round, and next week, we'll introduce one final challenge that leverages code you may have already written for this contest.Last week, you had a tricky little problem: you needed to write some code that looked like it was going to cheat, but really would get the cheater caught.Before we get to the Honorable Mentions, let’s once again tip our hat to Alexander, who once again decided to enter using APL. What can I say, I’m a sucker for any language that requires a specialized keyboard to write.cards←{⊃a ⎕RL←(⊂↓5 5⍴,{⍵[25?⍴⍵]}d↓↑,5/{(,'CDSH'[⍺]),(('234567890JQKA')[⍵])}/¨⍳4 13),⊃ts,d←200⌊0⌈¯1200+⎕RL-⍨ts←200⊥2↑3↓⎕TS}As always, all of the winners are up on GitHub.Honorable MentionsThis one’s from Niels, who did a good job hiding his cheat deep down in a .NET feature called an extension method (for the unfamiliar, extension methods let you “add” methods to classes without actually changing the classes’ implementations).
CodeSOD: Foxy Checksum
Pavel D inherited some… we’ll call it “software”… that helps run warehouse operations for a boiler/heating manufacturer. That software was a Visual FoxPro database.Now, this application needs to read barcodes off of products in the warehouse. Since the laser-scanners can sometimes mis-read those barcodes, the database uses a custom check-sum algorithm.
The Old Ways
Greg never thought he’d meet a real-life mentat.“We’re so happy to have you aboard,” said Jordan, the CEO of IniTech. She showed Greg to the back end of the office, to a closed door marked with just one word: Frank. Jordan, not bothering to knock, opening the door.Greg was overwhelmed with the stench of burned coffee and old-man smell. The office was unadorned and dark, the blinds drawn, illuminated by the blue light coming from an aging CRT screen. He saw a wrinkled scalp behind a tall, black office chair.“I’m busy,” Frank said.Jordan cleared her throat. “This is your new programming partner.”“I’m Greg. It’s nice to meet you–” Greg offered his hand, but a wrinkled appendage slapped it away.“Get yourself a chair. I know where everything is. You just show me you can type.”Greg shot Jordan a glance as they left Frank’s office.“He’s been with us 22 years,” she said. “He knows everything about our code. But his typing’s not what it used to be. Just do what he says. With some luck he’ll be retiring in a few months.”Total RecallGreg pulled a spare office chair into Frank’s den. He could see Frank’s face in profile now, resembling the mummy of Rameses II. Frank slid his keyboard to Greg. “Open C:\project.make in Vim,” Frank said, “and go to line 22.”Greg thought it was odd that a makefile would right under C:\, but he did so. He moved the cursor to line 22.“Increment $VERSION to 8.3.3.”Greg noticed that Frank had his eyes shut, but humored him. In fact, line 22 did declare a $VERSION constant, and Greg changed it to 8.3.3.“You’ll be suitable,” Frank said, crossing his arms. “You’ll do your work from the SMB server. Don’t make any changes without my authorization first.”Change ManagementBack at his desk, Greg found the SMB server where Frank kept all of his code. Or rather, the SMB mapped all of the files on Frank’s hard drive. Curious, Greg searched for .pas, .make, and other source files, wondering why Frank would keep his principle makefile under C:\.There were 440 source files, about 200 megabytes, spread out all over the directory strucure. C:\Windows\System32, C:\Users\Shared\Project, C:\Program Files\… Frank’s entire computer was the de facto source repository.Greg knew if he ever had to make an on-the-fly change to the source, it would take hours just tracking down the right file on SMB. Surely they had a repository he could check changes into. Greg took a deep breath and re-entered Frank’s den.“Frank, do we have any of this in a repo somewhere? I don’t want to SMB onto your computer every time we make a change. What if we have to patch something overnight?”“What?!” Frank rose from his office chair, unsteady on his disused legs. “There will be no code changes without my direct supervision! It’s worked just fine for 22 years. Is that understood?”In MemoryGreg endured this for several months. Frank would harbor no suggestions of version control or repos. Everything, Frank said, was in his head. As long as no one changed the source without his permission, he would know where everything was.Despite his frustrations, it greatly impressed Greg. Especially when Frank had memorized loop variables such as these:
Error'd: Nil, null, nihilism
"Figures. A suggestion devoid of meaning," writes Blake R..
Thorough Monitoring
Mr. Reynholm took great pride in his technical knowledge. Of course, as is often the case with CEOs and self-appointed CTOs of technology startups, that didn't necessarily mean he possessed any in the first place. But what Mr. Reynholm lacked in skills, he made up for in charisma. His designer suit, Brilliantine-laden hair, and the ability to turn a reading of El Reg with a thesaurus into a business pitch kept the company afloat despite the lack of any real product to speak of.And as Jenny sat behind her ebony desk in Reynholm CorpoTech's office, reminiscing about her "technical" interview from two weeks ago, she thought that maybe she shouldn't have been that eager to accept her first real job offer from Mr. Reynholm's hands.Suddenly, the loud ding of an Outlook notification snapped her out of her thoughts."Hey, Rob," she asked a young guy sitting to her right, "what's a, um ... Technical Meet-Up With Mr. Reynholm? Do I need to attend?""What, again?" Rob sighed, checking his email. "Aw, no. Aww, Jesus. And it's this afternoon?""Let me guess, it's not a fun ride?" Jenny asked."Well, that depends on how much you value your sanity," Rob said. "Think 30 minutes of buzzword bingo plus 30 minutes of Star Trek-grade technobabble, blended together to give you an hour of absolute common sense violation.""Yikes. Can I—?""No, you have to be there," Rob interrupted her. "But hey, there's always pizza afterwards. It's from some really good place, too: Mario's Pizza, or something like that."Jenny decided to bite the bullet. After all, meetings were part of a professional programmer's job. Numbing her brain for an hour couldn't be that hard.The shiny, high-tech meeting room easily hosted all the company's coders. While most of them eyed the side door, hoping for the pizza guy to show up, Jenny focused on a large, strange object in front of the speaker's podium, covered with a bedsheet."What do you think that is?" she poked one of her colleagues.“No idea," he said, trying to hide a yawn. "Probably some marketing gadget. Trust me, there's no way it's something interes—""AHEM! Let's start, shall we?"The lights in the room cut off as Mr. Reynholm entered the stage, silencing everyone."So! Developers! Developers, developers, developers, as one Steve Ballmer used to say. The best of the best, crème de la crème, the relentless force of progress! Do you know why I gathered you here?"Nobody raised a hand. Well, Jenny thought, it's not like you bothered to include an agenda..."You see, here at Reynholm CorpoTech, our mission is to bring technology to everyone. It doesn't matter who or where you are. If you want to take this journey with us, we're waiting for you with arms wide open. For you see, I had a dream, and in that dream I was a poor child living on the streets..."As much as Jenny tried to stay professional, her attention frequently wandered away from the speech."...and by making our company webpage viewable from even low-budget devices, we'll make our userbase as inclusive as possible. Which brings me to today's topic: responsive web design! You see, content is like water..."The audience's collective grimace told Jenny it was okay to let go. A lot of words were being said, but none were worth listening to.A half-hour later, the lights cut back on, startling everyone awake just as Mr. Reynholm approached the sheet-covered contraption."And now, I present to you ... The Responsive Testing Workbench!" He pulled away the sheet and let it drift to the floor.Jenny blinked, then blinked again. The revealed table housed a great-looking PC tower, an ergonomic keyboard and mouse ... and six monitors of different sizes, from a huge 4K to a tiny fourteen-inch CRT hooked to a converter."With this setup, we'll be able to see how our website fits on any screen," Mr. Reynholm explained triumphantly. "Tiny ones, huge ones, we're prepared for anything! And I see we already have questions! Jenny, wasn't it?"Jenny nodded, her raised hand still in the air. "Um, do we need all those screens? Can't we just test the website at different resolutions?"Everyone was looking at her now—some with a smirk, others with genuine compassion in their eyes.Mr. Reynholm didn't miss a beat. "Of course we could, and we will, but that's not the point! You see, when you browse the website on this huge screen, the fonts and images are bigger. On a small screen, they're smaller. So we need these monitors to see the website through our all our users' eyes. Understood?""But ... but ..." Jenny was about to object, but the first lesson in being a successful employee dawned on her. Sometimes it's better to let your opponent win. "I guess you're right. Sorry.""Now now, no need to apologize, we're all here to learn! Now, back to the Workbench ..."Months passed slowly at Reynholm CorpoTech. With two top-tier graphic cards, an overclocked processor, and open administrator account, the Workbench found its true purpose as a great time-wasting device. As for Jenny, she gained confidence and bonded with her team, but as the torrent of venture capital slowed to a trickle with no projects past the planning stage, she found herself looking for greener pastures.Eventually, she ended up in front of Mr. Reynholm's office door."Oh, Jenny! Come on in,” he waved her inside. "By the way, have you seen any 14-inch monitors around here? I want to check the website at that size, but the Workbench is busy.""No, I don't think we have any," Jenny said. "Can I show you a little trick, though?""Oh, I love learning new things! Come on, I'm all ears!" He shoved away from his PC, offering her control of the keyboard and mouse.Jenny found the resolution settings and scaled them down to 1024x768.Mr. Reynholm marveled at the results. "Now that's clever! That means I can finally test the website from my own office! It's nice to have all you geeks around to teach an old man new tricks.""I hope you can make do with one less," Jenny said, handing Mr. Reynholm the envelope with her two-week notice. "I'm sorry. It was great working here, but I guess … I guess sometimes you need to look at things from several perspectives."[Advertisement] Scout is the best way to monitor your critical server infrastructure. With over 90 open source plugins, robust alerting, beautiful dashboards and a 5 minute install - Scout saves youvaluable engineering time. Try the server monitoring you'll 👍 today.Your first 30 days are free on us. Learn more at Scout.
Bring Your Own Code: The Lucky Deuce: In the Cards
Two weeks back, we introduced the Lucky Deuce casino contest. This is a series of challenges, brought to you by our pals over at Infragistics, where we call on you to help us build a “scoundrel’s casino”.Last Week, you were again given some vague requirements, this time for building a broken slot machine. Once again, we had some seriously great submissions. Like last week, I’ve rehosted the winning code here.Honorable MentionsWe didn’t get quite as many submissions this time around, but while folks didn’t quite top themselves for quantity, we still got some serious quality.First, we have to give credit to Alexander, who delivered his submission in APL. That’s a clever solution for making certain your code is obfuscated enough that nobody will detect your cheat.
CodeSOD: At Least There's Tests
Having automated tests for a project is a good thing, as a general rule. We can debate the broader merits of “TDD”, “ATDD”, “BDD”, “ATBDDSM”, how much test coverage is actually worth having, and if we should view our test approach as a series of metrics that must be met, instead of some guidelines that will help improve our development process.Our first exhibit today is from Paul. It’s a JUnit test, that, well, maybe misses the point of writing unit tests:
Reactions
Data Security. We all need to deal with it. There are many tried and true ways of doing things. Many of the problems you'll encounter have been solved. Some of them will require creative thinking. All require a basic understanding of the difference between big thing and little thing. Not everyone possesses the ability to differentiate between the two.R.J. works for a health insurance company. These folks have access to some of our most private information, and take HIPAA regulations to secure and protect it quite seriously. Any breach of security requires notifying customers of potential exposure, as well as reporting to government imps bureaucrats better not dealt with. Naturally, the bean counters from the board on down all repeat the mantra of protecting the customer data at all costs.The team that employs R.J. developed the phone menu system. You're familiar with these beasts; they're designed to teach you Zen levels of patience while you try to do something, anything, while preventing you from having contact with a human. To that end, they allow you to perform all manner of tasks, provided you can stumble through the maze to the right sub-menu, and enter the magic code(s).One day, while snoozing on his bus ride home, R.J. got an emergency email entitled Potential Personal Health Information Exposure. As he grudgingly opened the email, the familiar Star Trek red-alert security-whoop sounded. The mail details stated that every enterprise level team (e.g.: all of them) had to be on an emergency call immediately! Wanting to be a good Red Shirt, R.J. jumped onto the call.Unfortunately, along with 9 levels of management, all in full panic mode, there was only one other person on the call; a DBA.After 15 minutes of managers pouring gas on the fire and assuring each other that there was plenty to panic about, the DBA got a moment to talk. There wasn't an actual data breach and no information had been affected or viewed. As part of a routine audit, the DBAs had discovered that a determined individual could find out that member id nnnnnnnnn had a birthday of yyyy-mm-dd. The DBAs already had a fix and just wanted to let the consumers of the data (e.g.: R.J., and all the other teams that hadn't joined the call) know that the affected data would be unavailable for a few hours while they applied their change.This set the managers off on a rant that could only be had if you were a manager:
Error'd: Are You Using?
"No! Never! Absolutely not!...Well, OK, back in college. Just once," writes Jack R..
Jibber Jabbered
Robert was proud of the system diagnostic and monitoring setup he architected, despite his manager Jim's weird insistence that it be done with XMPP. Their company was responsible for managing network infrastructure at a variety of customer sites, so each customer ran a network monitor that used an off-the-shelf Jabber client to phone home. That central XMPP server itself was Ejabberd and would communicate with all remote nodes via SSL, happily returning information that no one but Robert and his team could read. In order to prevent other nodes from talking to each other, they were only buddied with the central XMPP server. It was the "perfect" setup.As tends to happen with people who do good work, Robert got pulled away from his XMPP system to save another project from sinking. It would continue to work well enough on its own without much hand-holding. When new nodes needed to be added to the system, that duty fell to Robert's coworker Jens. He kept complaining that it was too much work to pair the new nodes with the XMPP server, but Robert brushed it off because for someone like Jens, tying his shoes was too much work.Jens had been mysteriously quiet about the XMPP setup duties for a while, before he randomly shouted "I just showed you up, Bobby!" one day. Robert assumed he accomplished something meaningless like topping the office high score in Tetris. "Since your XMPP system is so hard to maintain, I took the opportunity to make some improvements! No more painful setup!"Robert immediately began to feel a sense of dread. Anything Jens touched turned to crap and now he had been messing with Robert's pet project. "What exactly did you do, Jens? Everything was set up the way it needed to be for security's sake.""First, I got rid of that EJabberwocky setup, or whatever it was. That was pointless- there are much more lightweight Jabber servers out there!. Then I created a single account group for all the nodes so now whenever we add a new one, BAM! It can automatically talk to the XMPP server. This is way more manageable than the junk you had set up."Every client site was now buddied with *every other* client site. "Dammit, Jens! Why couldn't you just leave it alone?" Robert said, fuming. "Do you realize that now every node can talk to every other node and get information from it?""Yeah, well so what?" Jens retorted, taking up a defensive posture. "What are they going to do, have a big chat party? Chill out, man.""No, this means that anyone out there who has access to our remote nodes can simply log in and get information from every other node on the network, including the ones at customer sites.""HA! What are the odds of that happening?" Jens scoffed. "Let's take it to Jim and see what he thinks!"Robert and Jens raced to Jim's office to see who could prove their point first. Robert won but didn't get the answer he was hoping for. "You see, Robert," Jim began to explain, "we can do things the hard way here, or we can do them the efficient way. What Jens has done here will save him countless hours of setup over the course of a year, freeing him up to do even more important things!"Robert swallowed his pride as they left Jim's office, Jens sneering behind him. Jens destroyed his perfect system, and gave himself more time to screw other things up in the process. Robert was left to wonder if he should give Jens an unexpected Ejabberd to the throat as payback.[Advertisement] Use NuGet or npm? Check out ProGet, the easy-to-use package repository that lets you host and manage your own personal or enterprise-wide NuGet feeds and npm repositories. It's got an impressively-featured free edition, too!
Bring Your Own Code: The Lucky Deuce: Getting in the Slot
Last week, we introduced the Lucky Deuce casino contest. This is a series of challenges, brought to you by our pals over at Infragistics, where we call on you to help us build a “scoundrel’s casino”.Last week’s challenge was to build a “broken” roulette wheel, that instead of being truly random, avoids recently spun numbers to “feel” more random. I’ve rehosted all of the winners’ code here.Honorable MentionsMany of you noticed that, with our rather silly requirements, you didn’t need to do anything to make a cheating wheel. By simply betting on the least recently used numbers, your odds were enough to beat the house. This was true, but that’s not a terribly fun approach. Still, Ryan gets credit for taking that reality and putting a “thumb” on the wheel, so to speak. His solution was to be a little sloppy in how he weighted the probabilities, taking a heavy hand:
CodeSOD: Count On It
If there's one thing more exhausting and ridiculously over-complicated than moving house, it's moving legacy apps. Something as simple as a migration to another, identically configured (in theory) server can cause unexplained breakages and weird glitches in bits of the code no current staff member has ever touched.Mikail's company knew better than to try to extract this particular app and repot it in another server. After all, most of the core functionality was written by interns several years back, and since it wasn't in source control at the time, nobody had been willing to touch it. But with a major merger came a domain name change, leading to a slew of unexpected errors in production (Test environment? What test environment?).The following was designed to obtain a number from the query string so it could figure out what product to display. Most seasoned .NET professionals would go right for Request.QueryString["number"];, but not this special snowflake:
The Coming Storm
As someone who has spent more than three decades working for all manner of huge financial-conglomerate IT departments, I've seen pretty much every kind of WTF imaginable. At every level. At every scale. For years, I chose to view it as getting paid for being entertained. But over time, it dawned on me that perhaps the reason these companies are so inept at IT is that they're so focused on the job of getting business done that they can't take the time needed to learn to think through a software development project in the way you need to in order to, well, develop software.This time around, I joined a fairly small financial firm that has a reputation for being fairly laid back. Most of the reviews by current and former employees stated that the management allowed them the time to (reasonably) properly plan out and run a software development project. I spoke with several managers, all of whom assured me that the project was reasonably budgeted for the appropriate folks (developers, QA testers, business analysts, project managers, architects, etc.). Requirements were being mandated by an industry edict. My role was simply to be one of more than 100 Java developers on the project.After two months on the job, it became clear that it was all a smoke screen.Apparently, while the industry edict was fairly specific as to what needed to be done, the business analysts and architects could not agree on how to do it. You see, the architects were drawing data flow diagrams showing what data flowed between what systems, and where things would need to change in order to implement the new requirements. However, the business analysts decreed that all of the old systems needed to go away and all new systems would need to be built.Naturally, the technical folks laughed raucously and pointed out that this would entail about 10,000 man years of effort, whereas simply augmenting all of the existing systems would take about 200 man years of development effort.The BAs put their collective foot down and refused to allow any architecture documents to be released to any of the teams. No new data structures would be specified. No interfaces between systems would be defined. Nobody would be allowed to start work building any of the components until the BAs were satisfied that what was going to be done would make them happy.This started about 3 months before I was hired, and went back and forth for about 5 months.Not a single page of documentation of what the new requirements were intended to accomplish, or how it would be done was distributed to any of the technical folks.After two months on the job, it was best summed up by this conversation (that took place over three weeks) with my boss:
Error'd: Piles of Unsanitized Clothes
"I'm not sure if the WTF is that I have to find 0000FF]2 piles of dirty clothes," Simon H. writes, "or the fact that the ']' makes it look like they entered the information in something resembling BBCODE."
CodeSOD: Listicle
The Top 10 Ways to See if an Item Is in a List, Only 90s Kids Will Get thisPardon the clickbait headline. We’re only going to look at one method to tell if an item is in a list. A bad one.Andrew M. inherited some software that tracks metrics. There are three general categories of metrics- “MS”, “FN”, and “CM”. Each of these categories contains a number of specific metrics, each assigned its own ID.So, the previous developer needed to write a function that answered this simple question: given a metric’s ID, is it an “MS”, “FN”, or “CM” metric?
Bring Your Own Code: Introducing the Lucky Deuce
The life of a developer is about being cunning. When presented a problem that could be solved with strenuous, character-building labor, our first instinct is to automate it and cheat our way around it, if at all possible.Or maybe I’m just projecting. Still, if there’s one thing I’ve noticed, TDWTF readers are a shifty lot of scoundrels. It’s time for us to put that cunning to work.Thanks to our sponsor Infragistics, for the next five weeks, we’re going to call upon you to build us a Scoundrel’s Casino. Each week, we’re going to introduce a simple programming challenge, and give you a few days to solve it. Each week’s challenge is independent of the last, and each week is going to be a little bit harder than the week before.And prizes? Prizes! The “best” entry each week, judged by completely subjective criteria, gets a spanking new TDWTF mug, a single-developer license for Infragistics’ controls, and some super-sweet stickers. There will be some additional prizes (more piles of stickers) for submissions that seem cool and fun. And most important, every entrant gets the best prize of all: bragging rights.The Lucky Deuce Casino You are a developer for an online casino, and thus a wanted criminal in the United States. While you hide from the FBI, your managers keep sending you requirement after requirement, with absurd deadline after absurd deadline. You haven’t even met the other developers on your team- you write one tiny module for the casino, and it gets taken away from you and bundled with modules written by programmers you’ve never met, and the end product is almost certainly a bug-ridden mess.You’re sitting inside a seedy motel on the outskirts of town. You’ve got the blinds closed, but that doesn’t stop the neon sign for the diner across the street from keeping you up all night. You haven’t gotten a decent night’s sleep in days. You’re wondering what you’re doing with your life, and how you can get out before you end up in jail, or worse. And then- DING! An email comes in, bearing the latest requirements for a new module. You’ve had enough of this. You’ll implement it, alright, but you’re not going to settle for the pittance of a salary they’re paying you. You’re gonna get what’s coming to you.The RequirementsThe first requirement is pretty normal. You’re supposed to write a module that generates random numbers like a double-zero roulette wheel. They don’t specify how the random numbers are generated, but that’s basically a single line of code. Super easy.It’s the second requirement that makes you groan with frustration. They don’t want the numbers to be really random. “In a true random sequence,” the write, “the same number may appear many times in a row, just do[sic] to random chance. While that is actually random, it doesn’t feel random to our players.” They want you to track a history of the random numbers generated, and make something that “feels” random: numbers that have appeared recently are less like to appear. “Runs”, where the same number appears 3 times in a row, should never happen.“Alright,” you say to yourself, “I can do that.” But you can do one better. In addition to implementing their requirements, you decide to add in your own. You’re going to write in a “cheat” function- something that lets you either enter in some sort of cheat code, or in some other fashion makes the output of the roulette wheel predictable. Be careful, though, you don’t want to get caught! You'll need to get creative to make sure nobody stumbles on your secret- millions of people are going to gamble with this program.Entering & JudgingTo enter, send an email to byoc15@worsethanfailure.com with a link or attachment of your code. In the body of the email, explain how your cheat works and what we need to do to run your code. You can use any language you like, but we have to be able to run it with minimal setup.You don’t need to build a GUI, but if you do, and you do it using tools from Infragistics, we'll send you a free license (one per entrant, supplies limited). Consider this your Infragistics bonus.Assume we have access to stock Windows, Linux and OSX instances, if we need to run your software locally. You could target MUMPS running on a mainframe, but we can't run it, and you probably won't win. You must get your submission in before 11:59PM Eastern Time, Sunday the 9th of August to be eligible for judging. We'll announce the winners next Wednesday, along with the next leg of the contest!The overall winner will be chosen by how interesting and fun we think their solution and cheat is.Thanks to Infragistics for making this possible.A worldwide leader in user experience, Infragistics helps developers build amazing applications. More than a million developers trust Infragistics for enterprise-ready user interface toolsets that deliver high-performance applications for Web, Windows and mobile applications. Their Indigo Studio is a design tool for rapid, interactive prototyping.[Advertisement] Scout is the best way to monitor your critical server infrastructure. With over 90 open source plugins, robust alerting, beautiful dashboards and a 5 minute install - Scout saves youvaluable engineering time. Try the server monitoring you'll 👍 today.Your first 30 days are free on us. Learn more at Scout.
The Galapagos
IT jobs are few and far between in the rural United States. Calvin considered it pure luck that he got a new job as a developer in his home town, a small Southern town of only 5,000 people. After a few short interviews, he gladly accepted the job, eager to give up his long commute to another city and stay close to home.His new company, ITWerks, was actually the former IT department of a local-but-large tractor company that had gone defunct twenty years earlier. ITWerks had managed to get spun off and survive on its own, handling general IT and development tasks for many other businesses in the area. The market was tiny, but competition was scarce, and since ITWerks was the sole vendor in its little corner of the state, it had little reason to change. Without any incentive to learn new processes and technologies, ITWerks became an isolated island of 1995 which was inexplicably transported to 2015.Calvin’s first task was to fix a few bugs in their web API. The API tied several different products together. He scheduled some time with Hank, the original developer, to get an overview of the product. Hank had been with the company for thirty years now, and hadn’t learned anything new in at least twenty. His overview was brief and uninformative.“I’m sure this API will look modern enough to you young whippersnappers,” Hank said. “Now, I originally done this in Visual Basic 5, but when C# came out, I decided to take a looksee and I rewrote this whole thing with C#. It’s been purrin’ like a kitten ever since. Anyway, all the source code is in a shared folder. Go ahead on and grab that, and let me know if’n you’ve got any questions.”“No source control?” Calvin thought to himself as he settled in at his desk. “In 2015? Source code in shared folders?” He shook his head and wondered what he had gotten himself into.He found the source easily enough… and was horrified at what he found. The API only had one class, called WebService.asmx, which was a hundred-thousand line monstrosity, all contained in a single source file. And though it was nominally written in C#, much of the underlying functionality was provided by old VB5 and VB6 DLLs, which the C# assembly called into using runtime-callable-wrappers.Calvin spent the next few weeks engaged in intense archeology. Despite the massive, convoluted, and uncontrolled codebase, he was able to find and fix the bugs assigned to him without too much difficulty. Late one morning, he met with Hank again to see what the deployment process was.“Deployment? We don’t really do no deployment,” Hank replied.“How do you put code into production?” Calvin asked, clearly confused.“Oh, that? You just need to build it, is all.”“What do you mean?”Hank laughed. “Bless your heart. I mean, in Visual Studio, go on up to the ‘Build’ menu, open it, and click ‘Build Solution’.”Calvin paused for a couple seconds to see if any sudden understanding would strike him. It didn’t. “Sure,” he said, “that compiles the code. But how do I deploy that to the web server?”Hank started to look annoyed. “Listen, you just build the solution, and that deploys it to the web server.”Calvin feared that he was starting to understand Hank, but hoped he was wrong. Hank excused himself to go to lunch, and Calvin headed back to his desk to check something.His suspicions were horribly, horribly correct. The network share Calvin had been using to work was mapped to a virtual directory in IIS. Calvin had unknowingly been releasing changes to production every time he pushed the “build” button- releasing code for an API that was used by several applications and a few dozen customers.Despite ITWerks being a WTF-filled cesspool of mid–1990’s development practices that were horrible even in the 90s, Calvin decided to stay. He has enough leeway to slowly drag ITWerks into the modern era. They’re now using Git and Continuous Integration on some of their projects, the deployment process now involves actually choosing to publish your code, and now there’s a test environment. Calvin especially enjoys his new commute. Instead of driving an hour each way to the big city for work, he gets home in about ten minutes to find his muddy kids running up from the creek in the pasture to greet him. That’s a fair trade in his mind.[Advertisement] Manage IT infrastructure as code across all environments with Puppet. Puppet Enterprise now offers more control and insight, with role-based access control, activity logging and all-new Puppet Apps. Start your free trial today!
CodeSOD: Save Yourselves!
Scott K was cleaning up a configuration utility used by his team when he dredged up this sanity-threatening artifact:
Error'd: No Color? No Problem!
"Samsung's printer technology must really be something," writes Tim, "A black and white printer able to output a full color photo?! Who knew!"
Coded Smorgasbord: If You Want To
We pick on date handling code a lot here, simply because there are so many ways to mess up date related code (because dates are hard). In a way, it’s almost like we’re cheating. Even smart programmers could mess that up. What about basic conditional logic? How hard could that be to mess up?Well Jan L. came across this solution to a simple boundary check- if telegramType is between 100 and 199, it is a payment type telegram.
What's The Password?
"So, first day, huh?""Yeah." Jake loosened his tie nervously and straightened his suit. Standing in a room full of geeky-looking guys in T-shirts and hoodies, he felt like a time traveller from centuries past."Don't worry, a few days and you'll get a grip of how we do things around here." Steve, Jake's superior and tour guide, couldn't suppress a sly smile at the expense of the new guy. "Anyway, that's our office, here's your desk." He pointed to one of the open plan seats, quickly swiping an empty Coke can off of it. "And remind me, you're the back-end guy, aren't you?""Well, my strong suit is database work, but I know Ruby and PHP too," Jake said. "Also some basic HTML and CSS, if there's a need.""Nah, don't worry, we have lots of people doing this. Speaking of people, let's go around and say hi to everybody, then we can grab a coffee and breakfast — there's a nice vegan cafeteria downstairs — and by 11:00 all your accounts should be set up and we can get you some real work to do.""Sounds good to me," Jake replied as they walked toward the other end of the office. "So, can you tell me what you guys are doing here?"Two hours later, after making all his acquaintances, discussing the upcoming project, and eating what appeared to be a piece of cardboard coated in sea salt, Jake finally ended up in front of his shiny, triple-monitor workstation."Okay, our SVN is at https://svn.initrode.com." Steve took a free seat nearby. "The account should be there already. You know how to connect to it, right?""Sure, but I'll need my credentials, right?" Jake asked."Oh, that's simple," Steve replied. "See, since we were tired of people going around asking for passwords, we developed this little tool called PassMan. It's sort of a keyring, keeps all your passwords together. Just open the command prompt and type 'passman'."Hearing that, something in Jake's brain instantly threw a red flag, but he kept his mouth shut. After all, the first day at a new job was not the best time to question the company's processes. For now, he decided to oblige.
CodeSOD: You've Got My Number
Today's snippet needs very little introduction. In the words of the submitter:
We're All Admins Here
Will, his boss Rita, and Nick from HR huddled around a conference room speakerphone, listening to their new marching orders from the giant company that’d just bought out their small 100-person shop. Big changes would be avalanching down from Corporate over the next several months. For the moment, they were going over the modifications required to be compliant with their new overlords’ IT policies.Twenty minutes into the call, nothing major had come up. Will dashed down notes, thinking this wouldn’t be so bad after all…Then the voice on the other side intoned, “Local admin rights for all users.”Will and Rita glanced up from their laptops with a start, sharing the same wide-eyed look of alarm.Nick glanced between them, picking up on their consternation, but unsure what it meant. “Uh, guys? Is that doable?” he prompted.“Hang on a sec.” Will reached out to swat the Mute button on the speakerphone. Then, he couldn’t help himself. His glimmer of amusement turned into a snort, then a giggle, then full-on loud laughter—laughter that Rita joined him in.“What is it?” Nick asked, more confused than ever.“Local…? Sorry. Local admin rights for everyone?” Will sat back in his chair, pressing his palms against his eyes as he recovered his breath.“It basically means we’d be giving everyone here carte blanche to install and run and change whatever they want, whenever they want, on their computers,” Rita explained. “That doesn’t sound so bad, but in reality, it makes us vulnerable to malware, viruses, security attacks, you name it.”“Some people do need admin rights to perform their jobs, but not everyone,” Will chimed back in. “It’s gonna open up huge cans of worms.”“Well, shoot,” Nick said, concerned. “I don’t know if we have much wiggle room. Let’s see what we can do.” His finger hovered over the Mute button. “You’re willing to explain to them why it’s a bad idea?”“In depth!” Will said.“OK.” Nick un-muted the speakerphone. “We’re back now, thanks. Um, so, about the local admin thing—”“We know you have objections,” one of the disembodied overlords replied casually.Will, Rita, and Nick traded surprised looks.“Most of you small fries do when you come aboard,” the voice continued. “Sorry, but that’s our policy. Non-negotiable.”This marked the first time Will had a pronounced sinking feeling about their acquisition. It wouldn’t be the last.“I really don’t want to do this,” he told Rita a few days later, poised to make the ordered changes.Rita gave an apologetic shake of her head. “I appealed it as high as I could, kid. We don’t have a choice. Do me a favor: keep track of the extra tickets and problems we get as a result of this, OK? Maybe then I’ll have the metrics I need to get someone to listen.”“It’s the metrics that matter.” With a distasteful shake of his head, Will got to work. “Can’t wait to see what comes in first.”To their surprise, a full week of peace and quiet ensued, but this was merely the calm before the excrement-storm. Early on a Monday, emails flooded the support box.Oh no where are my database icons?Did you guys do something to my machine over the weekend? I’m missing a bunch of shortcuts…Mysteriously, each user was missing the exact same set of desktop icons: 5 shortcuts leading to the databases located on the network.His unfamiliarity with the problem, and horror at the sheer number of emails, sent Will careening to Rita’s cube. “Ever see anything like this before?”“No,” she replied. “Does this have anything to do with enabling local admin rights?”Will frowned. “I don’t really see how. I’m not sure what it is. I’m just gonna write up a quick batch file to re-add the shortcuts and push it out to everyone.”So he did. The shortcuts reappeared, and worked perfectly. Everyone was happy. It was tedious, but Will made sure to log and close out a separate support ticket for each email he'd received, just in case he needed those blessed “metrics” later.More like ammo, Will thought. Oh well, he doubted he’d ever run into this again.Exactly one week later, the universe told him what he could do with his doubts.“Those same icons are all missing again!” Will told Rita.“OK, it really does seem like this has something to do with the admin change,” Rita said.“How?!”She shrugged and sighed. “Let’s find out.”They pored through event logs, antivirus logs, GPO lists, and logon scripts. Nothing pointed to anything.“Maybe Google is our friend?” Will proposed.A few searches later, he had the answer: the infamous Windows 7 Computer Maintenance. If there were more than 4 broken shortcuts on the desktop, it deleted them completely. No Recycle Bin, no Unused Icons folder, just obliterated. It ran its maintenance tasks once a week on startup, after the desktop icons loaded, but before the network drives finished mapping. That meant the database links were "broken,” and were therefore deleted.Windows Computer Maintenance required local administrator access to automatically delete icons off the desktop.The icons could be retrieved via system restore, but Will wasn’t about to walk dozens of people of varying degrees of computer literacy through mounting a restore point and browsing to where the shortcuts lived. He ended up writing a startup script to manually recreate the shortcuts after all the other bizarre startup processes had finished doing their thing.Again, he logged and closed support tickets for each email received. Two weeks after making everyone an admin, Rita had metrics-ammo spilling out of both pockets, but after a round of emails and conference calls, their overlords did not care.[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!
Error'd: What is this 'Right Click' You Speak Of?
"What makes this worse is that this wasn't an edge case," wrote Roger, "I only right-clicked in the body of an email."
CodeSOD: Patterned After Success
Design patterns are more than just useless interview questions that waste everyone’s time and annoy developers. They’re also a set of approaches to solving common software problems, while at the same time, being a great way to introduce new problems, but enough about Spring.For those of us that really want global variables back in our object oriented languages, the Singleton pattern is our go-to approach. Since it’s the easiest design pattern to understand and implement, those new to design patterns tend to throw it in everywhere, whether or not it fits.
Finding Closure
Jim’s mail client dinged and announced a new message with the subject, “Assigned to you: TICKET #8271”. “Not this again,” he muttered.Ticket #8271 was ancient. For over a year now, Initech’s employees had tossed the ticket around like kids playing hot potato. Due to general incompetence and rigid management policies, it never got fixed.Jim was the GUI developer for their desktop application, InitechWORKS. The app used a web browser widget to display content from the company’s web page within the application, mostly for marketing fluff. The bug itself was a tracking pixel which occasionally failed to load, and when it did the browser widget replaced the pixel with a large, unsightly error icon. Both the web page and the tracking pixel came from Marketing’s web server.Time after time, ticket #8271 landed in some luckless developer’s hands. They each tacked on a note, saying there was nothing wrong with InitechWORKS, and forwarded the ticket to marketing. And time after time, Marketing punted the ticket with a note saying, “Can’t reproduce, must be an issue with InitechWORKS, re-assigning.”And so, once again, Jim decided to talk to the project manager, a middle-aged man named Greg with the memory retention of a dying goldfish and a management style with all the flexibility of a beryllium rod three feet in diameter.“Greg, I was looking at ticket #8271. I know Marketing won’t fix this bug, but I have a quick fix to suggest-”Greg had no idea what ticket Jim was talking about, but he didn’t need to. His flexible management policy came into play. “Per company policy and the org chart, the InitechWORKS team cannot talk to Marketing.”“But they need to fix something on their end!” Jim nearly shouted, hoping to get the full sentence out before Greg interrupted him.With a sigh, Greg pulled up the ticket. His mouth moved as he read it to himself. “See here, Marketing says the issue is with InitechWORKS, not Marketing.”“But they’re wrong. It’s definitely not-”“Marketing is never wrong,” Greg said with a cold stare. “Now, go fix this bug.”Jim walked away, dejected. He knew Greg wouldn’t remember this conversation the next time ticket #8271 came up.Jim couldn’t assign the ticket to Marketing, but he added his suggested quick-fix along with the note, “Problem is with the web page, not InitechWORKS,” and moved the ticket to Greg.Later that day, Greg approached Jim at his desk. “Jim, about ticket number…”. He paused to glance down at his notepad. “… number 8271. I passed it over to Marketing, but there’s a problem.” Greg lowered his voice and became indignant. “I had to delete your comments and ‘fixes’. We can’t presume to tell Marketing how to do their job.”Jim mentally facepalmed. His plan had failed. “But it’s a si-”“They’re smart guys, and I’m sure they’ll fix it,” Greg interrupted. “You do your job, and let Marketing do theirs, and we won’t have to get HR involved with a formal reprimand.”Two weeks later, Jim’s mail client dinged. “Assigned to you: TICKET #8271” was on the subject line. He groaned, and started planning how he was going to approach the issue this time. When he went to Greg’s office, the project manager was nowhere to be seen.“Have you seen Greg?” he asked the PM in the neighboring office.“Oh, didn’t you hear? He quit this morning. HR refused to discipline one of his employees, so he quit on the spot. Said something about the company refusing to follow their own policies. And now I’m inheriting a lot of his projects, so if you don’t mind…” The PM went back to work, silently ignoring Jim.Jim glanced back into Greg’s office and noticed that Greg’s PC was unlocked and logged in. On a whim, he sat down at the computer. As a PM, Greg had special privileges, like the ability to disable the automatic computer locking, and access to pretty much any system in the company. That included Marketing’s production web server.With a little poking around, Jim found the problematic web page and its tracking pixel. He quickly implemented the quick fix he’d suggested earlier, simply styling the image to be zero pixels and located 10,000 pixels off the edge of the screen. That wouldn’t fix the loading issues, but when it misbehaved, the ugly error would stay off-screen and not hurt the page.He slipped out of Greg’s office. Greg’s neighbor didn’t even notice him as he walked by. When Jim returned to his desk, he could no longer reproduce the issue. After a painfully long eighteen months, he marked ticket #8271 as closed.[Advertisement] Release!is a light card game about software and the people who make it. Play with 2-5 people, or up to 10 with two copies - only $9.95 shipped!
CodeSOD: The New Zero
If Alice needed to rate her co-workers, on a scale of 1–10, whoever wrote this is a zero. The goal here is to create a new string that is 4096 characters long and contains only zeros. This was the best approach Alice’s co-worker found:
Brillance is in the Eye of the Beholder
“E-commerce” just doesn’t have the ring it once did. The best-qualified hackers in the world used to fall all over themselves to work on the next Amazon or eBay, but now? A job maintaining the back-end of an online store isn’t likely to lure this generation’s rockstar ninja coderz, which explains why Inicart ended up hiring Jay.As far as Colleen could tell, her boss had been trying to add a developer to their team for at least a year. Scott was always on his way to interviews, second interviews, phone screens, and follow-up Skype calls… but summer turned to autumn turned to Christmas, and Inicart’s dev team returned from the holidays to find only their waistbands had increased in size. But then came the day Colleen walked in to find the long-empty cubicle next to hers brimming with a brand-new task chair and workstation. She ran down the hall.“Scott!”“’Morning, Colleen.” The team lead was leaning back in his chair with the grin of a satisfied hiring manager.“So you… you found someone?”“That’s right.”“And they’re… good?”“Right again. He’s very good.”Colleen didn’t know what to say.“He starts next Monday,” Scott said. “You guys should get ready to do some onboarding.”Colleen flipped a mock salute, and scampered off to do just that. A new developer! This was huge: Colleen and her team might finally be able to take a break from fixing bugs and actually deliver a new feature!With all due respect to Scott’s hiring prowess, it wasn’t immediately obvious to Colleen what he’d seen in Jay. The new developer was sociable enough, joining the team at their various outings, but he wasn’t big on eye contact, and tended to wander around whatever point he was making until you just lost interest. Colleen didn’t want to write Jay off on his social skills alone, however; they needed someone to fix bugs, and pretty soon he was doing just that.Week three was when Colleen started to worry. Jay was tearing through the bug backlog, but, for a developer new to the team, the company, and the codebase, he asked very few questions. That is to say, no questions. Not wanting to be unreasonable, Colleen confirmed that her teammates were also concerned.She brought those concerns to Scott. “I mean, I’ve been on this project for years, and I have questions.”“Well, he is very good. He interviewed at Google, you know,” Scott said. “If you’re worried, though, maybe you could do a code review?”Like everything else about Jay, his changes seemed fine at first glance. His taste in variable names tended towards the unusual- booThu stuck in Colleen’s mind as one example (an abortive attempt to summon the Great Codethulhu?)- but Jay seemed to know more or less what he was doing. Then they found Jay’s proclivity for write-only properties. A bunch of classes had sprouted these strange properties, properties whose value couldn’t be accessed, properties that did weird things to the classes’ internal state, more like they were a function call than a property- it was like Jay had never learned about void methods.When challenged, Jay said, “Well, when I interviewed at Google, they thought that was a really clever design choice.” Of course, Jay may have interviewed at Google, but according to his resume, he never worked there.As the checkins piled up and the team dug deeper, worry turned into alarm. Large sections of code had vanished from the codebase. According to Jay’s checkin comments, the swaths he’d erased were “inefficient and useless”. Colleen would have been willing to argue the point about efficiency, but the missing code was better described as “handling rare but important corner cases in shopping cart processing”.Jay was obstinate when questioned about his unusual coding style. “I’m writing compiler-efficient code,” he cried. “If you don’t understand how the compiler turns your code into machine instructions, you’re never going to write an efficient program! That’s why I’ve been cleaning up your code.”The outburst that ensured Jay a place in Inicart legend forevermore took place when, in the wake of The Case of the Missing Corner-Case Code, Scott told Jay they were letting him go. After security had shown the raving developer out of the building, Scott let the team in on their final conversation.“I told him, ‘I’m sorry, Jay, but we have to let you go,’” Scott said.“You can’t do that!” Jay had replied. “I’m brilliant!”Scott had been so taken aback by this assertion that he’d been unable to stop himself from saying “Uh, no! You’re not!”Scott admitted this hadn’t been his most-professional moment. But the rest of the team forgave him: from then on, Colleen and co. had a new catchphrase whenever a teammate found a bug in their code.[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!
Error'd: Error Version 16
"I was filling out a survey for PayPal when this message popped up to let me know that I am at a testing stage," Ishai S. writes.
...4546474849505152