OR 

CodeSOD: Do Fiasco

Consuela works with a senior developer who has been with the company since its founding, has the CEO‘s ear, and basically can do anything they want. These days, what they want to do is code entirely locally on their machine, hand the .NET DLL off to Consuela for deployment, and then complain that their fancy code is being starved for hardware resources. Recently, they started to complain that the webserver was using 100% of the CPU resour

favicon of http://thedailywtf.com

Error‘d: From Error to Disaster

Theyre a SEO company, so Im pretty sure they know what theyre doing, Bjrn E. wrote. When your toddler has to study for their ITIL certificate, the least you can do is give them a nice desk to study on, writes Sven V. Esox L. wrote, They claim to be in top 5%...but where would they be if they set name? I guess you should never say never when it comes to Microsoft Dynamics 365, writes Andrew. Philip B. writes, Say what you like, CNN, but th

favicon of http://thedailywtf.com

CodeSOD: True Confession: Without a Map

Today, we have the special true confession from Bruce, who wrote some bad code, but at least knows it‘s bad. Bruce is a C# developer. Bruce is not a web developer. Someone around the office, though, had read an article about how TypeScript was closer to ‘real‘ languages, like C#, and asked Bruce to do some TypeScript work. Now, in C# parlance, your key/value pair data-structure is called a Dictionary. So, when Bruce got stuck

favicon of http://thedailywtf.com

CodeSOD: Tern Failure into a Success

Oliver Smith stumbled across a small but surprising bug when running some automated tests against a mostly clean code-base. Specifically, they were trying to break things by playing around with different compiler flags and settings. And they did, though in a surprising case. bool long_name_that_maybe_distracted_someone() { return (execute() ? CONDITION_SUCCESS : CONDITION_FAILURE); } Note the return type of the method is boolean. Note that exe

favicon of http://thedailywtf.com

Error‘d: Rise of the Sandwich Based Economy

When I ordered on Hasbro Pulses site, I dont remember paying using a large sandwich, but...here we are, writes Zeke. Yep, its Follow Up Friday again, soon to be followed by Bug Fix Saturday, Michael P. wrote. Great! Avast found something...and the rest is for me to solve, Bellons wrote. Scott writes, Statements like this can be easily reworded as we arent perfect, but we definitely suck less than our competitors. Yes, Im pretty sure I wis

favicon of http://thedailywtf.com

CodeSOD: What For?

Pretty much every language has many ways to do loops/iteration. for and while and foreach and do while and function application and recursion and It‘s just too many. Mike inherited some code which cleans up this thicket of special cases for iteration and just uses one pattern to solve every iteration problem. // snip. Preceding code correctly sets searchArray as an array of strings. searchCount = count(searchArray); if (searchCount 0) {

favicon of http://thedailywtf.com

A Problem in the Backend

Gary works at a medium company. Big enough that workers are specialized in their duty, but small enough to know people in other departments and to make turf wars a little more close and personal: danger close. Most of the departments see themselves as part of a team, but a few individuals see themselves as McCarthy, who will themselves alone save the company and defeat the enemies (who are all spies inside the company sent to destroy it from the

favicon of http://thedailywtf.com

Representative Line: Destroying the Environment

Andrew H sends a line that isnt, on its own, terribly horrifying. Utilities.isTestEnvironment = !prd.equals(environment); The underlying reason for this line is more disturbing: theyve added code to their product which should only run in the test/dev environments. Andrew doesnt elaborate on what that code is, but what it has done is created situations where they can no longer test production behavior in the test environment, as in test, the code

favicon of http://thedailywtf.com

CodeSOD: Switching Daily

A not uncommon pattern is to use a dictionary, or array as a lookup table in place of a switch or conditional. In some languages, like Python, there is no switch statement, and dictionaries are the main way to imitate that behavior. In languages like JavaScript, where the line between objects and dictionaries is blurred to the point of non-existence, it‘s a common approach. A lot of switch statements can be converted to an object literal w

favicon of http://thedailywtf.com

Editor‘s Soapbox: The Master is Simplicity

When I was in college, as part of the general course requirements we had to take Probability and Statistics. The first time around I found it to be an impenetrable concept beyond my grasp, and I flunked. Since it was a requirement, I took it again and barely skated by. Joy; I had cleared the hurdle! By that time, it had become clear to me that I was going into a field that required a whole lot more understanding of PS than I had acquired. Sin

favicon of http://thedailywtf.com

CodeSOD: Transport Layer Stupidity

Keith H‘s boss came by his cube. ‘Hey, you know how our insurance quote site has TLS enabled by default?‘ ‘Yes,‘ Keith said. The insurance quote site was a notoriously kludgy .NET 4.5.1 web app, with no sort of automated deployment and two parallel development streams: one tracked in Git, and one done by editing files and compiling right on the production server. ‘Yes, well, we need to turn that off. ‘

favicon of http://thedailywtf.com

CodeSOD: Inching Along

Procedures should be as small as possible, is good advice. Like any good advice, you can take it too far. Mike recently was asked to upgrade a SQL Sever 2000 database to SQL Server 2016. Since this was an upgrade, Mike wasnt supposed to make any changes beyond the necessary changes to make the upgrade work. Still, when he found a bunch of methods with the same basic naming pattern, he had to investigate. CREATE PROCEDURE [dbo].[sp_inchworm_1wk]

favicon of http://thedailywtf.com

CodeSOD: Interpolat(interpolation)on

C# has always had some variation on ‘string interpolation‘, although starting in C# version 6, they added an operator for it, to make it easier. Now, you can do something like {foo} has a {bar}, which can be a very easy to read method of constructing formatted strings. In this example, {foo} and {bar} will be replaced by the value of variables with the same name. C#‘s implementation is powerful. Pretty much any valid C# express

favicon of http://thedailywtf.com

CodeSOD: The National Integration

Sergio works for a regional public administration. About a decade ago, the national government passed some laws or made some regulations, and then sent a software package to all the regional administrations. This software package was built to aggregate reports from the local databases into a single, unified, consistent interface on a national website. Of course, each regional group did things their own way, so the national software package needed

favicon of http://thedailywtf.com

CodeSOD: How Many Quarters to a Dollar?

Myrtis joined Initech as their first on-staff software developer. Up to that point, Initech outsourced all the software development on their payroll/billing system. The contractor kept raising their rates, Initech‘s business needs kept growing, and eventually they decided it was time to hire an in-house developer. Which meant Myrtis got to inherit all of that outsourced development. All that code, all of which had some pretty significant f

favicon of http://thedailywtf.com

CodeSOD: If I Failed

Lets simply start with some code, provided by Adam: static bool Failed(bool value) { return value; } Now, you look at this method, and you ask yourself, what use is this? Well, scattered through the codebase, you can see it in use: bool bOK; bOK = someProcessWhichMightFail(); return bOK ? true : Failed(false); Adam went through the commit history and was able to get a sense of what the developer was actually trying to do. You see, in some p

favicon of http://thedailywtf.com

Error‘d: Professionals Wanted

Searching for Pink Tile Building Materials in Amazon results in a few novelty items sprinkled in, which, to me, isnt a huge surprise, Brian G. wrote, But, upon closer inspection...professional installation you say? Well, at least theyre being honest, Josh wrote. Brian writes, You know, I wonder if date math would qualify as business technology? If it doesnt, they should probably make an exception. Spotted in Belgium, I can only assume this

favicon of http://thedailywtf.com

All That Glitters

Sometimes the writing is on the wall; sometimes, you know you have to get out. Todays submitter, Pietyr, was in just that sort of situation. He decided to head for greener pastures, hoping for a job with a good atmosphere, someplace where he could take it easier and enjoy his work more. Initech was a startup, one that didnt have any clients yet. No external deadline pressure, just venture funding and free beer Fridays. Pietyr gave them a call

favicon of http://thedailywtf.com