Feed the-daily-wtf The Daily WTF

Favorite IconThe Daily WTF

Link http://thedailywtf.com/
Feed http://syndication.thedailywtf.com/TheDailyWtf
Updated 2026-07-29 16:15
Representative Line: Something Wonderful
Today, we look at a "representative comment" from Mark W. This particular comment appears on a function:
CodeSOD: Convert Back, Way Back
Windows Presentation Foundation, the XML-based UI framework for Windows, has its own "fun" quirks. One of its core ideas is that controls can be data-bound: that text box is linked to a numeric field in your model class. Type a different number, and the model automagically updates.That's fine for what it is, but of course you're going to need to give it some instructions on how to do those kinds of conversions for your own custom types. And that's where the IValueConverter interface comes in.You can write a class which implements that interface, which can then Convert and ConvertBack. Which, as a note, I hate that naming convention; which way is "back"? Well, that's controlled via an annotation. This is some of Microsoft's sample code, from their docs:
The Hard Goodbye
One minute, you're fine. The next, you're doubled over with tears spilling down your face while an aching black hole in your heart threatens to drag you into oblivion.Grief's funny like that.Aggie Shaw, my old friend and mentor, had died of a sudden illness at home. She'd lived alone. Who found her? How? I didn't know and never would. There was so much I'd never gotten a chance to tell her. She would've listened to me vent the frustrations and resentments I'd been burying over the years for sanity's sake. She would've known what to do.God, I missed her.As if that weren't bad enough, the brass expected Tech Support to go right back to business as usual. Maybe the rest of them wanted to bury their heads in casework. I didn't. Between this, the horrible winter commute, and the promotion I'd never asked for, going back to the office felt impossible.My boss wouldn't let me use sick time. He really should've; the grief had hit me like a goddamn truck. Good thing the start of the new year a while back had refreshed my stack of paid time off. I started burning it from both ends.When I wasn't flat on my back or nursing a migraine, I was stumbling around my tiny apartment with half a brain cell, attending to the bare minimum of survival. Eat this. Drink that. Where'd I leave my smokes? In the rare times I could think, my thoughts were plagued with darkness. I didn't know if I'd ever make it out of that mess.Then, Megan called.It was nearing noon that day. I was lying in bed, peering out my window at a dull gray sky and falling snow. I'd let everything else dump to voicemail, but when she rang, I answered with the urgency of a drowning victim grabbing a buoy.Hey," she greeted, her voice subdued. I heard about what happened. I'm really sorry."There was so much tumbling through my head, but none of it wanted to tumble out. Thanks," I managed.How are you?"Lousy."Wanna meet up somewhere that isn't work?" she asked. The Apex Tower has a big indoor courtyard. I eat lunch there sometimes. If we go around 10 in the morning, we'd probably have it to ourselves."Something in me leapt at the offer. I'd like that. Tomorrow?" I would still be on vacation-in-name-only.Sure," Megan replied. See you then!"I had something to look forward to. Part of my emotional burden lifted right then and there.It was a little easier to get out of bed the next morning. I took the bus to an unfamiliar spot of downtown, crossed a slush-covered plaza, and entered a skyscraper. The warm ground-floor courtyard boasted marble floors and immense windows for walls. Potted trees and flowers lined the perimeter. Huh, I'd forgotten those even existed.Megan was already seated at a metal table flanked by two chairs. When she spotted me, she jumped to her feet and waved, a knowing and sympathetic look on her face. She waited until I reached the chair across from her to say, You look like you could use a hug."I froze with surprise, one hand on my hat in the process of removing it. A hug? My puzzled brain tried to figure out just when I'd been hugged last. I had no idea. My body wasn't waiting around for an answer. It was already turning toward her, arms raised.Megan silently walked into my embrace and hugged back firmly.Tears spilled down my face. My heart ached. And yet, another part of my invisible burden suddenly lifted. Something in me had been dying for this, for my pain to be seen.Thanks," I muttered.We parted. While I doffed my coat and hat, Megan returned to her chair, sitting back down across from me. Whatever you need to get off your chest, go for it," she offered.I sat myself down, sniffled, blotted my eyes on my sleeve, then glanced high and low to confirm something I already knew: we were alone in that big empty joint. Still, I hesitated. At first, I wasn't even sure I remembered how to string words together to form a sentence. But then it started gushing out of me like a busted water main. You ever hear of rubber-duck debugging?"Megan blinked. No."Surprising. Most developers had, but she was fresh out of college. A programmer came up with it way-back-when," I explained. Whenever you're coding something and get real stuck on a bug or error, you find yourself a rubber duck. Go line by line in your code and explain to the duck, out loud, what you want the code to do. Eventually, you and the duck will find the point where your intentions and reality don't match up."She smiled. I like that."Aggie had a rubber duck in her cube she called RD," I continued. Whenever she was stuck with a support issue or even a personal problem, didn't know where to go next, she'd tell RD about it. He'd help her figure out what to do or ask next.When I first got hired, Aggie showed me the ropes. She always said, the best way to troubleshoot is to be the duck yourself. Get people, or hardware, or software to explain what they're trying to do. You'll figure out how to proceed.Some people are so upset at the problem that they take it out on the nearest target: the support rep who comes to help. Aggie could charm even the angriest people into cooperating with her. She was the best. She was the best, and all she got for her trouble was more work. Now that she's no longer of any use to them, they've swept her under the rug. They want me to replace her!"Megan's eyes went wide.I'm no damn manager! I told my boss where to stick it. I'm riding out my PTO, and then hell if I know what's next. I can't go back there, I'd just be dying in place. And for what? So the bum at the top of the food chain can have a third yacht?" I leaned toward Megan, my gaze pleading with hers. Look, I ain't afraid of death. I'm afraid of dying before I've lived. I don't want my only contribution to the world to be reimaging laptops and rescuing old printers. I can't do it anymore. Can't sit around complaining, either, I gotta do something! I gotta get the hell outta that joint!"There it was: out in the open again, no longer whispered but shouted from the core of my being. Leaving was the right call for me. I felt it in my bones.Megan held eye contact, blinking a few times. I remember you saying you wanted to leave. If you did, what would you do?"I'd never really let myself play with my little pipe dream. I dunno exactly. But I've bought myself time to think it over. There are options, like going freelance."She blinked again. Freelance tech support?"I majored in Computer Science back in school," I said.Her eyes went wide again. Really?"Haven't flexed those muscles in a while, but I could. Or I could get into something totally different. And you could come with." Well aware of how unhappy she was at that joint, I sat up straighter in my chair. We could start our own IT group. No bosses. Everyone an equal partner with an equal say in how things are run. And we could rope in anyone else who wants to come with!"Megan seemed intrigued at first, but then sobered. What about bills? Rent? Everything?"We could pool our resources and look out for each other," I said. That'd give us some time to get our feet under us."Her expression turned strained. Aren't you scared?"You bet I'm scared!" I glanced down at the table. When I first got outta school, the idea of spending the whole rest of my life at a full-time job terrified me. But it seemed like everyone around me was fine with it. I thought I was the problem. Bit my lip, put my head down ... for 20 years." I glanced back up at her pleadingly. Has it gotten any better? No. I've just gotten used to it. Another 20 years, and I won't be any good for anything else. That's if I make it that long! Aggie didn't. Look, there's no right or wrong answer, just what's right for you. Listen to your gut. If you don't like where you're at, I'm living proof that staying the course is the wrong move. Leaving is risky ... but so's staying put, you know. The next round of layoffs could be right around the corner. You might get stuck babysitting that scheduling algorithm you were telling me about."Megan listened intently to my rant. Finally, she nodded. You're right. I'm not happy where I am, and it won't get any better. Time to try something different."Still mired in grief, I had at least gained a new sense of purpose to keep me afloat in the storm. Megan went back to work like nothing had happened. With my remaining time off from work, I did some research into our options. Hunting around online turned up a highly-rated accountant who walked me through the bare-minimum corporate setup, the taxes and bookkeeping and all that. We both tracked down advice online from other freelancers who'd been where we were now. And we put out feelers among our coworkers. Our questions struck some nerves, but also stirred considerable interest. Reynaldo was in; we had ourselves a network guy. Sanjay, a backend developer, was a maybe who wanted more time to think it over.There were plenty who wanted to join us badly, but couldn't swing it due to debt, insurance, things like that. I urged them to think about one thing they could improve at work, one cause they could get behind. Whatever it was, I told them to start making it happen, one step at a time.As my PTO bled away, I found myself half-exhilarated, half-scared outta my wits.Finally, it was time to go back. That first morning seemed like any other, but with my secret purpose in mind, I sat on the bus and walked the bone-chilling streets with a secret strength hardening my spine. When the old joint appeared ahead of me, more foe than friend, I felt relief knowing our remaining time together was short.Tech Support seemed no different; everyone was quietly minding their own business. I'd had plenty of time to think about what I'd do on the first day. My plan involved skipping my cube and heading straight to Aggie's old office. After my talk with Megan, I'd decided to go looking for something. I had a snowball's chance in hell of finding it, but something in me insisted on trying.As I walked up to the closed front door, the first thing I noticed was my name, not hers, standing out in fresh, gleaming gold letters against the frosted glass. Pushing past revulsion, I grasped the doorknob and turned it.The door gave way to darkness. I flipped the light switch with my other hand and found an empty desk, gutted shelves, bare walls. Looked like someone had come through with a giant trash can and thrown out whatever wasn't bolted down. My revulsion intensified, but hey, at least I wasn't trespassing. I shut the door to my" office behind me and slowly approached the desk.There was nothing to be found out in the open, not even a stray paperclip. I sat down hard in her old chair, reeling for a minute. Then I searched the desk drawers in front of me: first the bank on the left, then the right. Empty. I pulled out the drawer just under the desk-and there he was, swimming between a few stray pencils: a rubber duck about 3 inches tall. RD in the flesh.It was as if Aggie had put him there for me to find. I couldn't believe it. My spirits soared in a way they hadn't for ages.Just as I slipped the duck into my trench coat pocket, the door to her-my-office swung open again, making me freeze. There stood Bill, my boss.I saw the lights on in here." A smug smile spread over his face. I knew you'd be back. Bet it feels great, knowing you're done babysitting all those morons and their computer equipment!"Was that it? Twenty-odd years of my life boiled down into one cynical statement? No, there was more to it than that. For every bizarre war story, there were tales of grateful people helped, challenging problems solved. It hadn't been all bad. But it was over, just not the way Bill thought.An electric mix of nerves and resolve jolted me to my feet. I told you to find someone else, and I meant it. This is my two-week notice."I left Bill agape in that threshold and hurried back to my old cube, where my company-assigned laptop, docking station, and phone still resided. I hung up my coat, sank into my old chair, and booted up the machine. I had such a mountain of email in my inbox that I didn't even want to look at it, but there was one message at the top that I absolutely couldn't pry my eyes away from:
Error'd: The Song that Never Ends?
"Watch to the end", the scammers demand. In today's episode of Error'd, the end is a longtime coming.But at least it's amusing. In the meantime, Amazon irked and/or terrifiedthousands of their customers last week by mailing out ridiculously inflatedbills. It's been covered extensively elsewhere but why should we miss all the fun?It wasWilly who worried "Amazon prices seem to have crept up this month, financeare going to have something to say"
Classic WTF: My Many Girlfriends
Classic WTF: Server Room Fans and More Fun
CodeSOD: Classic WTF: Fork and Log
CodeSOD: Classic WTF: The Table Selector
Error'd: Princess Pricing
Sam suggests this Error'd indicates "Disney+ preparing the ground for usage-based billing." I'm intrigued by the idea that Disney might charge by the minute, but I suspect the reality is far more mundane.
CodeSOD: Wait Longer
Karen was maintaining some specification tests that were flaky. Not extremely flaky, but three or four times out of a thousand, the tests would just fail. The tests were complicated, and some of the operations were timing sensitive, so it wasn't precisely surprising- but the problem was that they were actually generous with their timing windows. The unit tests passed consistently, it was only these functional, specification-based tests that failed.So, for example, there were sections in the tests where they wanted to wait at least 2ms. Since the code and tests were in TypeScript, they used the setTimeout function, which per standard JavaScript documentation warns that it may wait longer. But again, Karen was fine with longer.Unfortunately for Karen, the documentation for NodeJS is less specific, as it makes no guarantees about when the timeout function gets invoked. This means that it can fire the timeout before the time has elapsed.After many, many hours of debugging, that was exactly the situation that Karen found herself in. Which is why her very simple wait function went from:
CodeSOD: The Error Check
Today's submission is less a WTF and more a, "Yeah, that'd annoy me too."Stevie works in a code-base that's largely C, which means function return values are usually used to communicate to status codes. The standard:
CodeSOD: AAYFN
Jason M sends us some Ruby code.
The Easy No
Error'd: Einfach so
Do you say "a FAQ" or "an eff eh cue"? Peter says eff eh cue I think."This is a test"Peter G. harrumphed testily."Create an FAQ with exactly nine entries. Nine? Nine."
Flushed Out
While a project manager is frequently called upon for their planning ability, the real skill we want from project managers is their ability to communicate. The job of a project manager is to align the team doing the work, with the organization goals driving the work, with the management and leadership teams trying to understand the work, while juggling all the constraints like budgets, timelines, and the endlessly changing expectations for the project. A good project manager is worth their weight in gold. A bad one will cost their weight in gold.Mark was hired on as a contractor, reporting to Tegan. Tegan was fresh out of business school, complete with an MBA and a variety of project-management training certifications. Unfortunately for Mark and the rest of the team, and especially unfortunately for Tegan, she had absolutely no real world experience. To make matters worse, this wasn't just a software project: they were working on a system which matched newly developed software with newly designed mechanics and custom build control electronics. A group of experienced software engineers, mechanical engineers, and electrical engineers all found themselves reporting to a bright and shiny MBA. It's a role that she probably could have grown into, but management saw all the acronyms she continuously put after her name, and decided she could just take the whole thing over with no real guidance.It went badly pretty much from the beginning. Tegan was not a talented communicator. For example, Mark's team needed to know: on what timeline were the electrical engineers going to deliver the first prototypes, so the software team could start running bench tests of their software? Tegan's response was a fortune cookie message about balancing the complicated pipelines and lanes on the Gantt chart and hitting all of their milestones; like a fortune cookie, it was vague, important sounding, but ultimately empty.Of course, the natural reaction amongst the engineers was to just route around the damage: the various teams could talk to each other just fine without going through Tegan. That, unfortunately, did not go over well with management. Tegan, as the project manager, was their insight into the project. They needed her in the loop on everything. And she couldn't just be informed, she had an MBA. She needed to be making decisions. But she was unqualified to make those decisions, which meant the project gradually ground to a halt. Tegan's emails got more vague, her meetings got longer but accomplished less, and after a certain point, she just stopped replying to key email threads.The first few days of radio silence seemed like a gift. But as time passed and Tegan seemed uninterested or unable to reply to any of the questions the team had for her, the project started to flounder. The engineering teams escalated this problem to management. Management presumably went back to Tegan. At some point, feeling the weight of everything going wrong around her, Tegan sent out this email, which is definitely the best and clearest communication she managed during the project. It's arguably the clearest, and most accurate communication one could make in this situation:
CodeSOD: Module Test
TJ inherited a NestJS project. The original developers left the team many years ago, but they've left their mark in the codebase.
CodeSOD: On Hold
"Dragoncoder" supports a web application that has a "wait time" for access. I hate that that's a thing, but I recognize that there are real-world constraints where this might make sense. Still, I hate it. But that's not the WTF.
Best of…: Classic WTF: Difficult Personality
Error'd: Kaids Hen 2025
On the recurring transportbeat, this week brings us a handful of wtfs relating tomass transit. Nothing private."Thank you for traveling with Deutsche Bahn" sneers Philipp H. bitterly, explaining "The German railroad company sadly is famous for often beinglate and also has lots of other issues. While bookingmy next trip I'm asked to pick my seats forthe reservation. - Looks like they now stack seats oneach other or on the table. - hopefully the seatsfacing the wall at least have a window there. -winning the jackpot lottery also seems more likely than understandingtheir seat numbering system."
CodeSOD: The Most Dangerous Game
While we talk about bad video game code periodically, we generally avoid it because it's so specialized and while something like fast inverse square root is bad code from a maintainability perspective, it's great code for abusing floating points to make math fast.Itan Yldz sends us a snippet from a game's config file. I won't pick on the specific game, but this isn't some random build of TuxCart, but a released game sold on multiple platforms. It's from a small team, but it's an actual professional product running on many devices. What's notable about this is the game has multiplayer elements, which means networking code, which means...
Representative Line: A Specific Key
Today's anonymous submission isn't really a WTF, but it highlights the hardest problem in computer science: naming things.For example, let's say you saw a method called handleRSAPrivateKeyGeneration. You'd likely assume that it generates an RSA private key. More specifically, it accepts a request for a private key and handles that request. It's right there in the name.
The Hot Fix
CodeSOD: Off the Path
File path separators are a common pain point when writing cross platform software. Of course, not every programming language has a graceful API for handling that. For example, prior to C++ 17, you had to do some #ifdef preprocessor magic to handle that. Which people usually did (or they'd use the Boost suite of libraries).Code like this wouldn't be out of place or incorrect:
Error'd: Fi fa foe
First up this week is a little story about a fifafail. I do wonder if this was a failure of the television station, or whether there was something more to it than that.Hercules wrote to alert us to these World Cup shenanigans, explaing "At least the flags were correct. And yes, this waslive TV. The host got the country names correctly, andeven called out that the written text was wrong"
The Roadmap
When Gary was called in for a meeting with a few of his managers- because of course he had several- he thought it was going to be for an "attaboy", because things had been going really well for the past few months.Gary had inherited a mess, and taken over a nightmare application. It was the kind of application that should be a simple CRUD-style data-driven app, but somehow despite only having 20ish entities it managed, someone had generated 500+ controllers for managing them. Most of those controllers were copy/pasted code with minor changes in the WHERE clause of a SQL query.And that was just the code. The infrastructure was similarly a mess, with duplicate resources provisioned in their cloud host. There was no CI/CD, no unit tests to speak of, no deployment process that wasn't "manually copy these files and pray". And uptime? You've heard about "five nines", but this product was lucky to get even one nine. Especially because the manual deployment process meant a few hours of downtime.And that was just the infrastructure. The backlog was similarly messy. There were lots of tasks- many thousands- but not a single one had a priority. Most of the tasks were something like, "Fix database timeouts", or "Bug 531" with no description to explain what they were. At best, some of the "new feature" tasks linked to a Google Doc that explained a software roadmap that had been last updated in 2020.So with no guidance, Gary and the rest of his team got to work. Cloud costs were massive. Just cutting the duplicate resources would help, but with actual planning it wasn't hard to find even bigger wins. In total, Gary got the cloud costs down 60%- essentially saving the company a small multiple of his salary every year.With that out of the way, getting a CI/CD pipeline running was next. Within a few weeks, manual deployments were gone. Everything was automated. Downtime nearly vanished. And now, with all the cost savings in cloud resources, for a fraction of what they were paying, it was easy to automate provisioning test environments for each new feature.So Gary was very ready for some congratulations when he sat down with management. He was prepared to discuss all the wins he and the rest of the developers on the project had gotten over the past few months."I'm sure you know why we're sitting down," Manager the First said when they settled into the conference room."I'm sure," said Manager the Second."We have some concerns about your performance," Manager the Third said."My performance?" Gary asked."Yes," said Manager the First. "Let me pull up the backlog.""And the roadmap," said Manager the Second."Yes, I'm getting that up too, thank you." The trio of managers struggled with pulling up the appropriate pages, and after about 15 minutes, gave up. Instead, they discussed their complaint without visual aids. "You haven't completed any of the tasks on the roadmap. Bug 673 has been open since you started on the team. None of the roadmap milestones have been touched. There's absolutely no progress.""Okay, but that document was wildly out of date," Gary said. "Instead I put cycles into solving the actual problems we're having. I've saved the company a huge amount of money. I've gotten our development cycle time down to a fraction of what it was. And we have basically no downtime!""That's all very nice, I'm sure," said Manager the Third. "But none of that was on our roadmap.""Well, maybe we should set up a meeting to go over the roadmap," Gary said. "Because a lot of the tasks on there don't make much sense right now-""I don't think that's a good use of time," Manager the Second said. "Large meetings are expensive. Just stick to the roadmap, please."With that, the meeting ended. Gary went back to work...... updating his resume. [Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.
CodeSOD: Authorized Logger
Gretchen's company recently got purchased by Initech. Specifically, they were bought for their dev team, of all things. They had a few software products that were high performers, and Initech wanted that secret sauce. They bought the company, and then split the dev team up and migrated the developers to new products.That actually worked out okay for Gretchen, most of the time. For a few projects, the dev team was given some requirements and a free hand to figure out how to deliver them. They were free to reuse code that existed or rewrite entirely, based on their own judgement. They were free to pick the tools they wanted to use, and the results worked out well.But there were some projects that... were a different story. After those successes, Gretchen got moved onto a project that was 90% firefighting. The app had code like this:
CodeSOD: Do a Lot to Do Nothing
Today's anonymous submitter works in finance. I'll let them start the introduction:
CodeSOD: When False is True
Lillith was integrating some new tools into an existing Ruby on Rails API. The existing API allowed you to send a dry_run flag along with the request, so that you could have the service calculate its changes without applying them.The problem was, the new tool Lillith was integrating could send, in the body of the request, {"dry_run": false}, but the service would see it as true. Consistently.The helper method which checked for "true" parameters looked like this:
Error'd: Microbits
This week we have got a couple of Mathanon's. Maybe they're the same person, maybe they're not, there's really no way to know!Frist anon has a "Numeric fun fact" for us:"Got a form sent from work to express interest insome event. They actually enforced the validation that the answermust be a number, so I submitted "42"." Bravo.
Representative Line: Sort This Out
Today's anonymous submitter has spent a long time toiling through many, many tickets. Their effort has been an attempt to "save" their employer from the disaster left behind by by a highly-paid consultant. As one does, our submitter started with the highest priority tickets with the highest severity. Eventually, they whittled down that list, and had some bandwidth to start looking at the pieces of the code which clearly weren't exploding right now (because there were no tickets), but were likely to explode at some point in the future (creating a storm of tickets).Scanning through the JavaScript, our submitter found a sort function. That was automatically concerning- why was that particular wheel being reinvented?The first line of the sort function was this:
CodeSOD: Weekly Calculated
There's a language out there called "Progress Advanced Business Language" (or "Open Edge Advanced Business Language"). Just hearing that string of words in a sequence tells you you're in for it. It's a verbose, "English-like" programming language. But we're not here to pick on the language.A long time ago, Mirjam had the "pleasure" of working in a Progress ABL environment. At some point, one of the developers had needed to find a date six months prior to the current date. It didn't need to be accurate, and thus said developer littered the code with comments reminding everyone that it didn't need to be that accurate. They arguably spent more time defending the choice to be inaccurate than it would have taken to write code that would have been accurate.Mirjam doesn't have the code anymore, so what we have here is a mix of her remembered pseudocode, Progress syntax, and my attempts to clarify all of it. Let's not worry too much about the language, and instead focus on the logic:
CodeSOD: Required Fields
If you want to connect to another system, you need to supply credentials. That's a pretty obvious requirement. We can set aside the whole technical challenge of managing those credentials and the security problems various techniques create, and just focus in on: you must supply some credentials to authenticate.Lisa has inherited a method which connects to another system. It, correctly, will complain if you don't supply parameters for credentials. It will, incorrectly, mislead you about their requirement:
CodeSOD: Caught a Mistake
Daniel recently started a new job. His first task was to fetch some data from the database and render it to the user. Easy enough, and there were already wrapper functions around the database to make it easy. He called execute_read, passed it a query, and checked the results.There were no results. But the query definitely should have returned results. What was going on?
Error'd: No Rush
This week, friend Adam R. sent in an entry and included with it a link to a short-form YouTube video. Presumably this was a mistake, because I watched that video and the next one and the next one and the next one and after two hours I still haven't got this column ready. I won't share the video link with you. You're welcome.What Adam really wanted to say was: "The USPS offers a sincerely service called Informed Delivery that,every morning, emails you scans of the exterior of yourpostal mail that you're expected to receive that day, whichis a genuinely useful service (#not-sponsored). In today's digest, however,the subject line had an extra None thrown in there.Some Python script gone wrong that wasn't tested before production,perhaps?" We get lots of NaN, null, and undefined submissions, but None are actually rare.
CodeSOD: Dating in Hungarian
A horse can only be so tenderized, but as well established at this point: I don't like Hungarian Notation. Richard G sends us an example of yet more of it, being misused, as well as some bad date handling. That's basically two of the easiest things to complain about, so let's take a look!
CodeSOD: Delicious Fudge
Stella (previously) sends us a much elided snippet. The original code is several thousand lines contained in a single try block. But the WTF is pretty clear without seeing all of that:
CodeSOD: Driven Development
We should always be wary of "(.+)-driven development". Things like test-driven development, or domain-driven development are fine, but they're also frequently approached from a perspective of dogma, which creates its own terrible outcomes.But let's talk about domain-driven development. Without getting too bogged down into the details of the approach, the idea is pretty straightforward: describe you domain model without reference to any lower-level concerns, so you can effectively write your domain logic in an abstract language tuned to your specific needs. In other words, it's just a pretty good practice. DDD offers tools and techniques for doing it, and as stated, can be adopted as a point of dogma instead of technique.Julien joined a team which bragged about their use of DDD. Everything they did followed DDD best practices, they said. The fact that they piled up all sorts of related buzzwords when talking about it should have been a red flag.Here's one of their "domain" classes:
CodeSOD: Check and Check
Today's anonymous submitter sends us a React view that presents some admin options. Of course, it should only show us those admin options if the user is authorized to do that. So let's see how they implemented it:
Error'd: Bridge for Sale
"Scammer offers to buy Google" is certainly a new twist on a very old New York con.Jan B. explains"Scammers have found a new way to steal money, scrapLinkedIn profiles and then send out emails with fake offersto buy people's companies. I'm guessing suddenly they need somefees paid just before the deal is finalised. However, theymay need to improve their filtering before sending out theirscams, I don't even own Google!" I'm putting together a group of peopleto buy it, do you want to get in the deal? I'll just need you to transfertwo million to this SWIFT account...
CodeSOD: Build Up
If there's one thing that seems to be a constant source of issues, it's people constructing SQL queries through string concatenation. Even if you're using parameters in the query, I'm opposed to handling raw SQL as strings in my programs. My solution is always "use a builder"- an API that constructs a syntax tree that it can then render to SQL as needed. (Yes, a builder, not an ORM, that's a whole other discussion, I'm not dogmatically anti-ORM, but it's a leaky abstraction at best.)Many languages have such a thing, Java included. Lukasz's team was using Java, and they had a rule: "don't do SQL strings, use a builder". Unfortunately for Lukasz's team, their guideline didn't specify what kind of builder.
CodeSOD: Coerce the Truth Out of You
Frank suspected something odd when he spotted a use of React's useMemo function in some JavaScript code. Now, there's nothing wrong with using that method, in and of itself. It watches some variables and recalculates a callback if they change for any reason. It's a great tool for when you want to avoid recalculating expensive things over and over again.But in this case, the calculation in question was isAuthorized, which wasn't an expensive calculation; it was just checking if certain values are set. The code looked like this:
CodeSOD: Blocked the Date
Volodya sends us some bad date handling code in PHP. Which, I know, you're just reaching for the close tab and yawning when you hear that. You've seen it before. But bear with me, this one still has some fun bits to it.
Let's Be Facebook!
The real WTF is that our long-time friend and submitter Argle failed to dissuade all three of his sons from pursuing IT careers of their own:
Error'd: Super SEO Strategies
It's ironic -- this site gets absolutely inundated with blogspam from people trying to improve their SEO ranking, and yet the only requirement to get your website linked is one dumb little typo in the right menu.Faithful Michael R. is still job hunting, now even farther afield."I shall try the gigs in United Kingsom. https://electronicmusicopenmic.com/"
CodeSOD: What Condition is This
Untodesu sends us this submission, with this comment:
CodeSOD: Are There Files Yet?
Are there any files to send? That's the question that Chris C's predecessor had. So they asked it. Again. And again. And again.Chris writes:
Whales Ahoy!
The waters are even more dangerous than we imagined. Have a look at some of the crazed whales our brave submitters and commenters have encountered in the wild.First comes an Anonymous tale of woe:
CodeSOD: Classic WTF: One-and-a-Half-Tiered Application Design
Error'd: April is Special, and so are you
"April is special," writesElwin. It is, but take heart May, every month is special at TDWTF.
CodeSOD: In the Know
Delilah works in a Python shop. Despite Python's "batteries included" design, that doesn't stop people from trying to make their own batteries from potatoes. For example, her co-worker wrote this function:
12345678910...