When Maarten first saw the utility function below, he couldn’t imagine why converting a number from float to double required a string intermediate. Fortunately, whoever wrote this code followed best practices: their comment not only explained what the code is doing, it also explained why.
Handling dates is difficult.On paper, it doesn't seem to be a complicated task. After all, computers are good with numbers, and what are days, months and years if not small, supposedly easy-to-deal-with numbers?But behind this deceptively simple façade lie all sorts of nasty traps. The historical baggage of our civilization means that a good programmer needs to deal with tens of different date formats, multiple calendars, leap years, leap seconds, and some dates simply going missing. One might argue that humanity should've hammered out a more unified, common system long ago — but since we're still at least two hundred years away from adopting stardates, we have to keep accounting for each and every edge case.Fortunately, we coders are a smart bunch. Most languages have a good date library that takes at least some of that burden off our shoulders. Unfortunately, this being The Daily WTF, today's specimen decided to ignore them all and reinvent the wheel, with quite a few jagged edges...
Depending upon how long you've been in this industry, you've seen your fair share of bad design, bad code and bad users. Darren A. explains his dealings with bad management, and how a string of edicts there-from can crush kill destroy an organization.In the past, before management decided to, well, manage, Darren's company was able to complete 15-25 major projects each year. Then they hired a new Head of Software Services, who felt that he needed to actively manage all facets of how things were done...
The web team and the JDE development team rarely see eye-to-eye in Cho's company. Cho, the JDE developer, worked in a world full of Oracle databases and important financial records. Andrew, a web developer, worked in a world full of MS-SQL and sales appointments. So when Andrew asked Cho to put together a job that would remove debt records older than six years so they'd stop showing up in his sales reports, he figured she had things well in hand."Six years?" mused Cho. "I'll have to build a custom function to figure out the start and end dates... I'll get back to you."Two weeks after launch, several production incidents had been traced back to this new functionality. Of course, Cho had gone on vacation, so it was up to Andrew to dive into the seedy world of Oracle databases and debug the function...
Neil’s first contributions to the company codebase were to be tested in the fires of a late afternoon code review. Donavan, a veteran of Java since 1.1, was asked to sit in.It began as a thankfully uneventful affair — but then Donavan noticed that Neil had removed the finally from an existing try/catch/finally block.“Why’d you do that?†he asked.“Well, because a finally block is indeterministic,†Neil explained.Donavan frowned, smoothing out the startled What?! in his throat into a calmer, “What do you mean?â€â€œYou never know when it’s going to execute,†Neil elaborated. “It may never execute. It also causes severe performance and portability problems. It’s not good practice to use.â€â€œI’ve… never heard of that,†Donavan replied, patiently stowing his skepticism for the moment. “I can only think of two reasons why a finally block might not run: one, the thread executing the try/catch is halted or killed. Two, the JVM crashes or exits in the try or catch block.â€â€œI’ve read about this before. I know what I’m talking about,†Neil huffed, folding his arms.“Where’d you read this?†Donavan asked gamely.“I think it came from a book called Effective Java,†Neil replied.“I have that book,†Donavan replied. “This is news to me.â€Neil tugged at his collar. “Well, I — I think you’ll find the new code performs much better, and is safer.â€â€œDid you run any performance tests against it?†Donavan asked.Neil’s face grew steadily redder, until he wrapped around the spectrum and approached violet. “I have fifteen years of Java experience!â€The experience card? With Donavan? This guy was new, all right.“Whoa! You don’t have to get defensive about this.†Donavan put up his hands. “I just want to know why you did this, and what your source was. I’m not going to propagate this information by saying ‘Some guy told me this was the case.’ I’d like to read it for myself.â€â€œI know it was Effective Java,†Neil replied. “Look it up, if you want!â€The rest of the code review proceeded without fanfare. Upon returning to his cube, Donovan googled for information on when and why not to use finally in Java. He found nothing enlightening.Then he searched for “Effective Java finally.†There, in an online version of the book, Chapter Two made reference to avoiding finalizers, stating the exact same facts Neil had attributed to the hapless finally block.There it dawned on Donavan: Neil had either confused the terms, or he believed that a finally block was actually itself a finalizer.Donavan jumped up and checked Neil’s cube, only to find it empty. So he sent an email with the citation. I can see how the terms can be confusing, he added at the end, hoping to soften the blow.After clicking the Send button, Donavan sat back and folded his arms with a thoughtful frown, pondering the long-term effects of such an innocent slip. In Neil’s alleged 15 years of experience, how many finally blocks had he delete-keyed into oblivion?Fortunately, Neil wasn’t so set in his ways that he couldn’t correct course when proven wrong. He and Donavan had a good laugh about it the next day. And once Neil finally understood finally, they could finally program happily ever after.[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!
"'Soll das Fenster geschlossen werden?' means roughly 'Should the window be closed?'," wrote David, "Hovering over the 'No' option shows that it will invoke doNothing(). Thank goodness!"
As some readers already know, the Polish government is not on the best of terms with modern technology. We'd be damned, however, if that stopped us from trying- even if the end result is as much of a mess as Michał reports it to be.The story began in 2008, when the government decided it needed some presence on this new hip thing called the Internet. And so, the Electronic Platform of Public Administration Services, or ePUAP for short, was born- a website serving to ease communication between public administration and Polish citizens. It went mostly unheeded until 2011, when the Trusted Profile functionality was introduced- and with it, the ability for people to do taxes, file applications, and submit other paperwork fully online.Surprisingly, the website worked mostly fine. But soon after the first wave of interest, problems began to appear. Every update led to major downtime. Features such as password recovery would either break or have days-long delays. And, an investigation of a corruption scandal revealed that ePUAP- along with several other services- was the fruit of rather shady dealings.Michał's story concerns an incident from a month ago, when the whole system crashed and burned. Most users were unable to log in, and the lucky ones who could found that their Trusted Profiles and personal data were missing. It turned out to be a major problem for everyone who elected to do their taxes over the Internet, since the system broke down just a few days before the April 30 tax deadline. Their only other options were to wait several hours in line at their local public offices, get hit with huge financial penalties, or write formal letters to the tax department describing how sorry they were.The media caught the story, and managed to get a response from the Ministry of Administration and Digitization:The work on a new version of ePUAP is underway. Maintenance-related downtime is expected. There's nothing alarming about it. Unfortunately, the tests we do can't be fully done over weekends.Apparently, newfangled inventions such as "testing environments" haven't fully permeated the Iron Curtain. And so, this country-wide platform- holding the personal data of hundreds of thousands of people- is being tried in battle on production servers, during the year's most intense period of activity.[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!
Marino was handed this code. Like all great code, it’s written defensively, protecting itself against nulls, empty strings, and other unexpected values.I mean, sort of.
If you asked the web developers at XYZ Insurance, a mere network engineer like Billy had no business snooping around in their code. “He probably doesn’t even know what HTML stands for,†they’d sneer, and they kept sneering until a routine change to fulfill an audit requirement brought their internal website grinding to a halt.
Next time you get an unwanted email, before you kick it into the bit-bucket, give it a quick read through. If it makes you go "WTF?!", kick it our way instead. We love 'em!What's in a name anyway? (From Chris)Mr. LName (or FName as his friends call him) sure are racking up a lot of bills on my email.
"One very helpful error, followed by another, and then Oracle Forms Designer crashed," Owen C. wrote, "I suppose at least it made an effort to tell me something was wrong!"
On April 10th, I hosted The Daily WTF: Live! in Pittsburgh. It was a blast. We had a great crowd, and some great performances.Our final story is another one of my own, and this one is about… the worst boss ever. I mean it, and in this story, I can prove it. This is also arguably my first interaction with a real WTF.Direct Link(MP3)This episode is brought to you by our sponsor, Puppet Labs. Check out their intro video, it gives a pretty good overview of how they help their customers get things done. Start a free trial today!This brings our season of TDWTF:Live to a close. I had fun hosting and recording these stories, and I hope you had fun listening to them. Next Thursday will return to your regularly scheduled WTFs.And since Paula is freaking out at the moment, pop over here for the comments.TranscriptAt the Daily WTF, there’s one kind of story we get a lot of submissions for that we don’t often run, and these fall into the category of what I like to call a Bad Boss Story. There are three reasons we don’t run bad boss stories. The first one is you never really know if it’s truly that this boss was a terrible boss, or it was just somebody that has sour grapes. ‘Cause sometimes, you read them, and you’re like, ‘You just didn’t like the guy. It’s not that you had a bad boss, you just didn’t get along.’The other reason is that there’s nothing IT specific about any bad boss story. Everybody’s had a bad boss. Raise your hand if you’ve had a bad boss. Pretty much everybody. And that’s one of the other reasons we don’t run them, there’s nothing IT specific. But the main reason we don’t run a lot of bad boss stories, is because I had the worst boss.And I can prove this, and I’m about to in the next couple of minutes, I’m going to prove that I had the worst boss.My story starts a little bit like Mark’s. I was graduating college and it was just around the DotCom bust. And I did not want to, after graduation, go home and live with my parents. I was very, very opposed to this. I happened to have some friends who were generous enough to let me impose upon their closet. I lived in their closet for about six months, so I really wanted a job. I was not very picky about the job, there was nothing really going, so as soon as I found a job- and it was an IT job. I was doing stuff with Word and Excel, not programming, but it was an IT job. Y’know what, it’s an IT job, I’m going to take it, and I don’t care about any of the details.And that was my first mistake.So, I walk in on the first day, and the Big Boss, Tom, the owner of the company is there to greet me. And I’m kinda overwhelmed almost instantly by Tom. Because first, Tom was so orange that Tropicana has sued him for trademark infringement. It wasn’t just, like the bottle-tan, Jersey Shore orange, because he had grey hair, and he wanted to ensure that he didn’t have any seams, so he would work the tanning lotion into his scalp, so he had this fringe of orange hair all the way around.And that was just the first thing you notice. The second thing you notice is that he’s a very grabby boss. The very first thing he does is slap his hand on my shoulder and give it that… squeeze. “Hows everything GOING?†Ugggghhhhh.But everything was going pretty well, because I had a job, and in a couple weeks I was going to be getting a paycheck. Everything was going well. I was enthusiastic.I learned, very quickly, Tom was not- as much as he pretended to care (How’s everything going, SQUEEZE SQUEEZE SQUEEZE) he didn’t really care about his employees. So, when he needed you to work two weeks straight, 16 hour days, you were 16 hour days for two weeks straight. There was no compensation. There was no buy you a pizza. He didn’t buy you dinner. You just did that, because that was your job.And again, I was still kinda happy to have a job, so I would drag my ass in at 7 in the morning, and leave at around 10 PM at night, and I’d do that for two weeks straight, three weeks straight- no, actually, after the third week, I needed to travel to a different location, so Friday night after the third week I get Saturday, but then Sunday I have to go drive ten hours away to the other side of New York State, which is where this was based.So, that’s the next thing I learned about Tom. But y’know what? That’s still not why he’s the worst boss I ever had.I learned a few other things about Tom, over time. First off, Tom didn’t have a good sense of where he was at any given moment, or what his purpose there was. One day, I’m sitting in the break room with one of my co-workers, and Tom comes in- and he bursts, he just explodes into the room, full of energy. There is a reason why he has come into the employee break room. He is looking for someone, to tell them something, and he bursts in, and he’s about to do it- you can see him winding up, you can see the gears turning. Then he looks at my co-worker, and he looks at her tights, which have this check pattern on them, and he says, “I just want to play tic-tac-toe on your legs.†And then he turns around and walks out. And we just take a long moment, I look at Paige, she looks at me, and we ask, “Did that just happen?†and the answer is yes.Later that day, I was getting a cup of coffee and all of the sudden, THUMP “How’s everything going?†Ugh.Little later than that, we actually learned another fact, didn’t know it at the time. Tom, and his wife- who worked there, she was actually the Vice President- always a sign of a healthy company- they were swingers. And they did invite some employees to some parties at points. They did invite some employees to parties at points. I don’t know whether to be happy or insulted that this never happened to me, but y’know? None of that is why Tom was the worst boss I ever had.Tom was the sort of boss that really loved to have pep talks. Every Friday, at 4:30, you did not go home, you went to the mandatory meeting. There was no excuse that would get you out of that meeting. There was no excuse that would get you out of that meeting. If you called in sick that day, you couldn’t get out of that meeting. He really wanted to give you your pep-talk. And his pep-talk were absolutely content-free, but you also learned another thing about Tom.Friday, at 4:30, Tom would be dragging ass just like the rest of us. You’d see him in the hallway and he wouldn’t go “THUMP How’s everything going?†He’d be, “ehâ€, it’s Friday, at 4:30. But right before the meeting, he’d go into his office and close the door. And then the door would open, and (sniffling sound) he would come out and he was READY TO PEP YOU UP.But Friday at 4:30 coke fueled meetings were not why Tom was the worst boss I ever had.One day, I come into work, and Tom’s not there. Which, is actually a pretty good thing. Everybody’s pretty happy about that. Nobody’s upset that Tom’s not there, until Chris, the Ops Manager, starts running around frantically to everybody. “There’s a meeting during lunch, and you HAVE to be there. Don’t go to lunch, doesn’t matter if you didn’t think to bring a lunch, you HAVE to be at this meeting.â€I’m like, “Oh god, what’s Tom gonna do to us now?†Well, as it turns out, Tom wasn’t going to do anything to us, because Tom had drained the company’s bank accounts, run off to Connecticut, left about two dozen contracts unfulfilled, and was being hounded by lawyers. The content of this 12 o’clock meeting was “We don’t know where Tom is, we don’t know how to get in touch with Tom, but if Tom contacts you, let us know. The State Troopers would like to have a conversation with him.â€And that’s STILL not why Tom was the worst boss I ever had.If we rewind just a little bit, keep in mind I was just happy at this point to have a job, but if we rewind just a little bit… One day, I’m standing at a urinal, going to the bathroom, as one does, and all of the sudden…THUMP SQUEEZE SQUEEZE SQUEEZE. “How’s everything going?â€There’s so many witting things that you can think of after the fact, that you could have said or done in that situation, but when it actually happens to you, everything just shuts down. EVERYTHING shuts down. You just stop. You wait for it to be over. You wait for Tom to leave. You wash your hands. You just… cry briefly. And then you remember, at least you have a job.[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!
Whenever a program needs to perform a long running process, it’s important that it supplies some sort of progress indicator, so the user knows that it’s running. Sometimes it’s a throbber, a progress bar, an hourglass, or the infamous spinning beachball of death.
As most of you know, this last month I have been running another Kickstarter campaign, Programming Languages ABC++: an alphabet book all about programming.In the same spirit as Release!, and The Daily WTF, this project focused on the culture that surrounds our day jobs. Specifically in this case, it was all about getting kids interested in what we do.It turns out that a lot of people were pretty into the idea. We hit our goals in under 2 days, and for the last month have hit every stretch goal we set within hours of posting them.We still have through Thursday to drum up as much support as we can, so please check it out, and share it with friends.I wanted to put one last plug here because I am genuinely proud of this little book. I think it will really do its job and help to get kids excited about the idea of growing up to be a developer. Plus, I think it would make a pretty cool coffee table book for grownups too.Thanks so much,Alex[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!
Tim, the Hardware Enchanter worked at a small hardware/software company which made specialized instruments for a variety of industrial applications. When he wasn’t busy blowing up the English countryside, he designed hardware as well as its firmware- a mix of C and assembly code- which had to fit into 32KB of program memory with 2KB of RAM. He hardly ever touched application code, and was happy with that arrangement.The company’s next product was The Probe. It was a device for measuring and testing other hardware, and its data went to a PC for further analysis. Tim helped design the hardware and wrote most of the firmware, then waited on the software team to make the controller application.And waited. And waited.Finally, he went to speak with the head of the software team, a disagreeable man named Roger. “Who are you?†the man grumbled, obviously upset at his work being disrupted.“There are some who call me… Tim?â€â€œAnd what is your quest?â€â€œI need your software for The Probe so we can finish testing on the hardware end,†he answered.“Yeah, well, we’re busy,†Roger said gruffly. That wasn’t the response Tim was expecting.“Well, when will you not be busy? We need this software.â€Roger adjusted the arrangement of his keyboard and mouse on his desk before harumphing. “Listen, those of us who arrange and design applications are under considerable stress at this period. We have a lot to do and not enough manpower to finish it all.â€Tim bit back an expletive, “Well, put it on your list. I’ll throw together something quick to finish hardware testing, but we need you guys to come up with something nice before this sells.â€Roger didn’t even respond, and got back to the work of rearranging things on his desk. Tim went back to his office and got to work. He wasn’t really an application-software guy, but he was able to hack together something with a GDI+ GUI to communicate with The Probe. It was ugly, slow, and crashed a lot, but was good enough to complete the required hardware testing. He moved onto other projects while waiting for the software guys to do their job.And so he was quite surprised when, several months later, a customer bought The Probe in bulk, and the Powers That Be demanded immediate shipment. “We don’t even have software written for it yet!†Tim protested.“Roger told us that you wrote the software and it was all ready to go.â€â€œWhat? No!†Tim was astounded and started shaking his head. “I wrote an application to test The Probe’s hardware interface, but it’s just an internal tool. It’s the most foul, cruel, and bad-tempered application you ever set eyes on!â€â€œDoes it work with the hardware?†they asked.“Well, yes…â€â€œThen we’ll ship it. We need this sale. It’s Antioch Industries, and once they buy it, everyone else in the industry will be falling over themselves to upgrade, too.â€Tim started to protest again, but The Powers That Be turned to the Release team. “Go on Bors,†they said, “Package a release.â€â€œRight! Silly little bleeder. One shipped product coming right up.â€And so, his slow, unwieldy, segfaulting GDI+ application was burned onto a CD, labeled with sharpie, and packed into a box with The Probe. The kaboodle was shipped off to Antioch, like an unholy grenade, waiting for the customer to pull the pin…… and when it finally did go off, all Tim could say was, “I warned you, but did you listen to me? Oh no, you knew, didn’t you? Oh, it’s just a harmless little piece of software, isn’t it?â€[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!
Managing namespaces in JavaScript presents its own challenge, since the language’s default behavior is to start slapping things into window. For this reason, people have built a number of libraries and practices to solve this problem.Jared’s company, for example, uses RequireJS to load dependencies, like the lodash utility-belt library. Sadly for Jared, their new hire proved that all the module-loading libraries in the world don’t solve incompetence.
On April 10th, I hosted The Daily WTF: Live! in Pittsburgh. It was a blast. We had a great crowd, and some great performances.Seth is a long-time reader of The Daily WTF, and manages to be "all over" the local tech scene. I've met him at a few TDWTF meetups, but also seen him at Code & Supply events. And today's story features robots, so what's not to love.
A few months back, Alex announced our sponsorship program. This has been a great partnership that’s helped us bring you our regular content, but also special features like TDWTF: Live.We’re proud to introduce our second sponsor: InfragisticsA 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.Infragistics tools allow you to create rich desktop apps in WPF or Window Forms, responsive Web apps in HTML5, JavaScript & MVC, and native mobiles apps for iOS, Android and Windows Phone. Their products are used by companies like IBM, Intel, AT&T and ESPN. Later this year, we’ll do a deep dive into their products.Thanks to the support of Infragistics, we’re going to be able to bring you some exciting new content, arrange more meet-ups, contests, and have more fun all around. To build amazing apps of your own, download a free trial of Infragistics Ultimate today. See for yourself why they're considered the worldwide leader in user interface and user experience development controls.[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!
Rebecca inherited some code that’s responsible for gathering statistical data from network interface. It was originally written a decade ago by one of those developers who wanted to make certain their influence was felt long after they left the company.The code was supposed to write to one of two log files: a “quick logâ€, with 2-second resolution (but only for the last minute’s data), and a “full logâ€, with 1-minute resolution.Unfortunately, it would often fail to do anything with the full log. Frustrated that this code- which had lived in a shipping product for over a decade- was so unreliable, Rebecca dug in to see what the problem was.
“You should get some real-world experience.â€D.H. was in college to study video game programming, and his professors encouraged him to find an internship. “The real programming business is nothing like these university assignments.â€
Booleans! What can you say? They're deceivingly complex features of any language, and only the most proficient among us is capable of using them properly.Miss M. discovered that one of her cow-orkers found a new way to get the most mileage out of a single boolean variable named count in a single method to see if:
On April 10th, I hosted The Daily WTF: Live! in Pittsburgh. It was a blast. We had a great crowd, and some great performances.John Lange attended the storytelling workshop I co-taught with Kevin Allison, of The Story Studio. His story- about gaming, and friendship, and technology- really struck a chord with me, and I wanted to make sure he got a chance to share it.
The position had sat open for months now; the department was straining under the load of too many projects and too few developers, but the pool of candidates was rapidly shrinking. So when Cindy found a resume that looked halfway decent, she immediately recommended tossing them a programming test and scheduling an interview. The phone screen is a bit superfluous given fifteen years experience, she thought. We'll just use a quick test and get to the good part.The test was simple enough: reverse a string, in your language of choice. They were hiring iOS developers, so the candidate was wise enough to choose Objective-C- usually a great choice to demonstrate that you won't need much training on the job.However, generally, you ought to actually be good at the language in question...
“Hello!†A perky voice chirped over Evan’s shoulder. “May I come in?â€It was unbearably early in the morning. Evan had yet to get into any sort of programming groove, and so swiveled away from his computer without difficulty. At the threshold of his cube waited a sunny young morning person he’d never seen before. Beside her rested a re-purposed overhead projector cart. Instead of AV equipment, it bore dozens of shiny new coffee mugs.“Hi! My name’s Kelly.†Beaming, she stepped forward and offered the mug in her hands. “A little treat from the Marketing team! We’re celebrating the creation of a new recruitment bonus program!â€Bleary-eyed and far less enthusiastic, Evan took the proffered mug. Harsh florescent lighting glared off its glossy surface, which read:Take A <b/>“Cute, huh?†Kelly asked.Evan managed a limpid half-smile, and nearly dropped the mug alongside the other glorified dust-magnets in his cubicle, before something made him do a double-take. “That’s the wrong tag.â€Kelly frowned in confusion. “What?â€â€œThere’s a typo,†Evan said. “You wanted ‘Take A Break,’ right? That should be B-R-slash, not B-slash.†He pointed to the mug for emphasis. “Right now, it says ‘Take A Bold.’â€â€œAre you serious?†The smile vanished from Kelly’s face. Her eyes went wide.“Yeah,†Evan said.“Really?â€â€œSerious.â€â€œReally?†Kelly bit her lip, but her eyes betrayed her mirth. “Oh my goodness. You have no idea how many meetings we had. This slogan got batted around everywhere, up down and sideways, and no one ever said anything about that!â€How many developers were at those meetings?†Evan asked. The company offered hundreds to choose from.“None. This was all within Marketing.†Kelly giggled freely. “This is everywhere! We’ve got posters, t-shirts, pens…!â€Evan joined in her laughter. “Of course. Printing promotional materials is our core business!â€â€œDon’t tell anyone else about this, OK? I’m kinda curious to see how long it goes before someone else brings it up.†Kelly returned to her cart and pushed it away, still red-faced and giggling. “Have a good one!â€Heh, typical. How often did Marketing ever vet anything with IT, or even think to? Evan couldn’t even think of any marketers or computer folk who had regular social contact with one another.Well, maybe that’s about to change, he thought with another smirking look at his new mug. The two teams could bond over some nice coffee bolds.[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!
“Hey,†Roberto said while pairing with an offshore programmer, “this problem would be easier to solve with the Factory pattern.â€â€œWhat’s that?â€Roberto explained both the Factory pattern and the idea of design patterns, and congratulated himself on helping a fellow developer improve their skills. Little did he know, he had created a monster.Things started cropping up in his code base. For example, Roberto found this block:
Andy writes: “Operations reported that a query was taking a long time. Even the 'developers' of this query didn't know why it was taking a long time.â€I tell ya, folks… some submissions, you just set down and back away slowly… then hunt up a magnifying glass and a bottle of aspirin.
It was Housekeeping Sunday in Dirk’s small IT shop, which usually meant taking their diminutive lot of servers down for routine maintenance. Dirk thought he’d change it up this week and add some actual cleaning to their housekeeping tasks. He knew just the man for the job too - Andrew, the Big Boss’s nephew.
When hiring programmers, recruiters will often try to be “cleverâ€. Sometimes, this results in a memorable trick, like EA Canada’s job posting billboard.Other times, these stunts don’t go nearly as well. Andrea recently got this job posting from a recruiter. Note, they’re hiring for a PHP job.
...and at 10PM, see if the investigators can track a killer who hacks an online game and tricks children into delivering illegal weapons on the next episode of...It was a quiet, lazy evening. Alan C. was in bed with his wife, getting his well deserved rest after a hectic week at work. Just as he picked up the remote to raise the volume, he was startled by a long, low growl."Hungry?" his wife muttered without opening her eyes."Guess so.""No way I'm cooking anything today. Let's grab a pizza."Alan sighed and picked up his laptop, looking for a pizza place nearby.Mario's Pizza - the best pizza in town! the first Google result screamed at him. Order by phone or online!Not wanting to disturb his half-asleep wife, he entered the website and clicked the big "ORDER ONLINE" button. After a few minutes of picking ingredients, sides, drinks, and sauces, he was ready to place his $50 order of "true Italian goodness". He scrolled down to the end of the form to submit it.Then he scrolled up. Then he scrolled left, right, and sideways, but no matter where he looked, he couldn't proceed with his order. The submit button simply wasn't there.But Alan wasn't a developer for nothing. A simple UI glitch wouldn't stand between him and his thin-crust treat. He fired up the console, opened the site's source, and typed:
"Joey," asked Ross of the new contractor, in a slow, careful voice, as though trying to calm a large predator. "Explain to me why the data tree has this read-only flag?""It's more secure that way. Obviously, if it's read-only, arbitrary people can't write to it."Deep inside our Jar? Are we afraid of our own code? Ross wondered, but he dismissed his doubts. Sure, let him have that one. "Okay, but why is there a flag at every single node of the tree?""Well, obviously, if only the root's protected, people can still edit the leaves and branches. We want to protect the whole tree.""Okay, but that means to edit the setting you have to visit every single node, which is O(n) at best.""Price of security, man.""Okay, but even so, why do you flip the flag before every insert, only to set it again after? Doesn't that make building the tree painful?""You can never be too careful." "Okay, even if I buy all that, and even assuming that this is the best possible way to solve this problem- which it's not- Why do you visit every node twice?"
On April 10th, I hosted The Daily WTF: Live! in Pittsburgh. It was a blast. We had a great crowd, and some great performances.You know him as the master of the Errords, the king of the CodeSODs, the Dev-Master of the Dev-Disaster, Mark Bowytz. Once upon a time, though, he was just another lowly office drone like yourself. This is his origin story: the WTF that launched a thousand head-desks.
Government Department prided itself on the precision of its process and procedures. Every function in the organization had its functionary, at least in theory. Joe had only been on the job a month when he discovered that figuring out which functionary would actually function wasn’t as easy as it looked. The Department used a database known as CAS to track all its financial data, including wages and work orders. Since Joe intended to earn wages in return for coordinating those work orders, he was going to need access to CAS. His first inkling that there might be a problem with the pervasive process was that, despite all employees needing at least basic CAS access for the payroll system, it wasn’t until his fourth week with the department that Terry, his team lead, gave him the good news.“You’ve been cleared for a CAS userid,†Terry said. “Go ahead and call up the CAS service desk to request it.â€â€œSo they haven’t created my ID yet, just cleared me to have one?†Joe asked.“That’s right. The CAS desk’s extension is 8888.â€Joe dialed the extension. At the other end was the cheerful recorded voice of one of those programs that asks you to say what you want instead of pressing buttons. Joe just blurted, “CAS.â€â€œFor new or returning Government Department employees,†the voice said, “contact the security unit at 8889, or speak to the CAS role 132 user from your local IT unit. Goodbye!â€Joe muttered to himself and dialed the next extension. This time, the voice was neither recorded nor cheerful.“Security. What seems to be the problem?â€â€œWell, I need a CAS account-â€â€œYou need to contact the CAS service desk.†And Joe was hung-up on for the second time in five minutes.The process having officially sent Joe in a circle, he tried the cheerful recording’s alternative. He found his way to the local IT office and asked the team lead there about CAS. The response was cheerful, not recorded… but not helpful, either.“CAS? Oh, we can’t give you that. The service desk’s extension is-â€â€œI already called them. They told me to talk to you… something about the CAS role 132 user?â€The IT Team Leader chewed on that for a while, then turned and picked up his phone. While he dialed, he looked over his shoulder at Joe.“You know, it’s funny! I just finished getting CAS accounts for some new team members- took three days in the end!â€Joe grimaced. The IT TL spent some time saying “uh-huh†into his phone, then hung up. He asked for Joe’s TL’s number, and promised to walk Terry through the necessary process. Joe returned to his desk and waited. That afternoon, Terry popped in to give him the good news.“I sent an email to that address IT told me about, it bounced back saying we need to contact the local CAS coordinator. I just emailed her, so we should be good to go any time now!â€Terry left, and Joe returned to his job of waiting to be allowed to coordinate work orders. Fortunately, it didn’t take long to get a reply from the CAS coordinator. Joe was CCed:
“If you want to put everything under test, you have to write code like this.â€At least, that’s what Alex’s co-worker said to him, when Alex demanded an explanation for this block of code.
"I clicked 'Yes' when asked if I wanted to send a report of VLC's crash, but apparently my attempted cooperation wasn't really appreciated," David K. writes.
TLDR; I have another Kickstarter Project, this time it's a kids book about programming!##Last year, I put a project up on Kickstarter that was inspired by things I personally love: games and software. Release! was supposed to be a one-off, quick card game project, but thanks to all of your help, it got pretty popular, pretty fast. We're halfway through selling our second print run of the game, and while it'll never do well enough to pay the rent... it may just do sell enough to get us a nice bottle of scotch, which we sorely need.I had such a great time with the whole venture that I wanted to put out another project. Which leads me to: Programming Languages ABC++. Here is the idea, it's an alphabet book which has a different code language for each letter: A is for Ada, B is for Basic, etc. Each page has a "Hello World" program in that letter's language, along with some facts about the language, and a colorful illustration of our mascot, the Computer Bug.Before you say it, I do realize that a toddler won't understand the code. It's not about teaching a baby to make a program, it's about creating a way for us parents, uncles, aunts, etc. to connect with the kids in our life. You know, share a little about what we do, in a context that the kids will actually enjoy.The whole thing started with my friends Michael and Martine Dowden, a pair of developers who had an idea to make an alphabet book that was all about programing. Within seconds of them explaining the idea to me I knew this would be the next fun project.Anyway, the project is live, and you can score a book for just $15, or a number of other fun rewards. Even if you don't have any kids in your life, and you've mastered your ABCs, backing at a $1 is still a great way to show your appreciation -- which, of course would be much appreciated![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!
Sally’s co-worker wanted to turn some data into HTML. It would flow from his application into client-side JavaScript which would build the DOM. He decided that it made sense to use a tree to represent the data as it’s translated.The C# declaration of his tree looked something like this:Dictionary<int, Dictionary<CatalogLoader_Helper.CatalogNode, List<CatalogLoader_Helper.CatalogNode>>> treeOBJMODEL;Isn’t it fantastic how Generics can make your code more readable and type-safe? I mean, that’s not what’s happening in this example, but…To traverse the tree, he used a terse, readable block like this:
On April 10th, I hosted The Daily WTF: Live! in Pittsburgh. It was a blast. We had a great crowd, and some great performances.Today's installment investigates exactly how a conference comes into being, told from the inside of Steel City Ruby Con.
When a system evolves and grows, it's usually necessary to identify various versions of software living in the wild. There are many ways to do that: some hide their version numbers in code, some keep them in configuration and metadata files, and others store them in the application's database.No matter the scheme, accessing and modifying the current version number should be easy and painless- that is, unless you're working with Stan K.'s codebase. In a truly brillant case of reusing existing system facilities, the developers resorted to a much less common method of determining which patches and upgrades have been applied:
In technology as in life, some folks get it, and some don’t. Trying to make the ones who don’t get it get it can sometimes challenge even the hardiest of tech-souls. Michelle made a valiant effort to enlighten one such individual, and failed. This is her story.Michelle’s predecessor had migrated their code-base from VSS to SVN, before fleeing for the hills. Michelle was “the replacement.†Before she finished finding her cube, she was cornered by her manager and peers with some concerns. “About this new-fangled SVN source control system,†they began, and then they tried to pin her down as to how she could address their “issuesâ€â€¦Specifically, Bob, the manager asked: “Is it true that in SVN, anyone can check-out the code?â€â€œOf courseâ€, Michelle replied. She explained that anyone with an account can check out the source code at any time. This started an avalanche of stupidity that, not unlike one of snow, only gained mass and momentum with time.Jim, the lead developer, said that this was a problem. “If I checked out a file, I would have no idea if someone else was working on that file as well.†When Michelle just looked at him, blankly, he continued: “VSS was much better in that respect.â€Michelle explained that this was the whole point, and in fact, one of the main benefits of SVN. Unlike VSS, SVN supports concurrent development, and it’s smart enough to automatically keep track of who’s changing what for you.Jim was worried that if he was working in an area of code, he needed to know that nobody else was working on it, so his change(s) wouldn’t get overwritten by the other developer.Michelle went on to console him by explaining the concept of merges and how merge collisions would be handled.“Yeah, but we’re working on a major bug and need to know that no-one else is working on those files!â€Michelle then explained the concept of branches. She further explained that the file history was available for examination, and in an extreme case, an automatic email notification could be sent where anyone on the mailing list would receive notification every time someone committed code.Bob and Jim would have none of that. Bob complained, “No that’s not good enough. We can’t risk developers clobbering each other’s code. You need to change this. When I go to the bathroom, I have exclusive use of the stall. Others can only use it before me or after me, but not at the same time as me. We need this same level of isolation in handling our source code.â€Try as she might, there was no explaining that this was really not necessary, as going to the bathroom and editing source code were, in fact, two very different things, and that it defeated the point of a multi-versioned, concurrent development environment…Bob insisted, in absolute finality: “No it’s too dangerous. Please change SVN to make to make it single check-out only; now! Before something terrible happens!â€In reality, something terrible already had. Michelle resigned herself to the stupidity of running source control in the same way as accessing a toilet, she wrote a trigger script hack to disable parallel check outs. But at the end of the day, she couldn’t bring herself to activate crap mode.[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!
Marcus inherited a big-ol-ball-of-mud PHP application. The entire thing is one difficult to summarize pile of WTF, but he searched long and hard to find one snippet that actually summarizes how awful the code is.That snippet is this:
On April 10th, I hosted The Daily WTF: Live! in Pittsburgh. It was a blast. We had a great crowd, and some great performances.Our first story is one of my own- a tale about how one computer virus finds its violent end.
It had been a long meeting, and Bert was exhausted. Now, normally when a story on TDWTF starts that way, we go on to tell you about a hapless developer trapped in management hell, but this time, we're flipping the script on you: Bert was the Business Analyst on a project to enhance some self-check software for a number of supermarket chains. Ernie, the Software Engineer, was one of those braindead devs who needs everything spelled out before he'll write so much as a line of code, and Bert was much more comfortable with the looser specs in Agile projects.Since the fourth Requirements Clarification Meeting was dragging on into hour two, Bert was getting a little snippy. So when Ernie asked for clarification on exactly how long a given printout might be, in millimetres, Bert couldn't help himself: he cracked. "Well, potentially infinite, I guess!"The code Ernie delivered: