Feed the-daily-wtf The Daily WTF

Favorite IconThe Daily WTF

Link http://thedailywtf.com/
Feed http://syndication.thedailywtf.com/TheDailyWtf
Updated 2024-05-18 17:16
Error'd: Time for more leap'd years
Inability to properly program dates continued to afflictvarious websites last week, even though the leap day itself had passed.Maybe we need a new programming language in which it'simpossible to forget about timezones, leap years, or Thursday.Timeless Thomas subtweeted "I'm sure there's a great date-related WTF story behind this tweet"Gosh, I can't imagine what error this could be referring to.
CodeSOD: A Bit of a Confession
Today, John sends us a confession. This is his code, which was built to handle ISO 8583 messages. As we'll see from some later comments, John knows this is bad.The ISO 8583 format is used mostly in financial transaction processing, frequently to talk to ATMs, but is likely to show up somewhere in any transaction you do that isn't pure cash.One of the things the format can support is bitmaps- not the image format, but the "stuff flags into an integer" format. John wrote his own version of this, in C#. It's a long class, so I'm just going to focus on the highlights.
Representative Line: A String of Null Thinking
Today's submitter identifies themselves as pleaseKillMe, which hey, c'mon buddy. Things aren't that bad. Besides, you shouldn't let the bad code you inherit drive you to depression- it should drive you to revenge.Today's simple representative line is one that we share because it's not just representative of our submitter's code base, but one that shows up surprisingly often.
CodeSOD: Moving in a Flash
It's a nearly universal experience that the era of our youth and early adulthood is where we latch on to for nostalgia. In our 40s, the music we listened to in our 20s is the high point of culture. The movies we watched represent when cinema was good, and everything today sucks.And, based on the sheer passage of calendar time, we have a generation of adults whose nostalgia has latched onto Flash. I've seen many a thinkpiece lately, waxing rhapsodic about the Flash era of the web. I'd hesitate to project a broad cultural trend from that, but we're roughly about the right time in the technology cycle that I'd expect people to start getting real nostalgic for Flash. And I'll be honest: Flash enabled some interesting projects.Of course, Flash also gave us Flex, and I'm one of the few people old enough to remember when Oracle tried to put their documentation into a Flex based site from which you could not copy and paste. That only lasted a few months, thankfully, but as someone who was heavily in the Oracle ecosystem at the time, it was a terrible few months.In any case, long ago, CW inherited a Flash-based application. Now, Flash, like every UI technology, has a concept of "containers"- if you put a bunch of UI widgets inside a container, their positions (default) to being relative to the container. Move the container, and all the contents move too. I think we all find this behavior pretty obvious.CW's co-worker did not. Here's how they handled moving a bunch of related objects around:
CodeSOD: Classical Architecture
In the great olden times, when Classic ASP was just ASP, there were a surprising number of intranet applications built in it. Since ASP code ran on the server, you frequently needed JavaScript to run on the client side, and so many applications would mix the two- generating JavaScript from ASP. This lead to a lot of home-grown frameworks that were wobbly at best.Years ago, Melinda inherited one such application from a 3rd party supplier.
Error'd: Once In A Lifetime
Not exactly once, I sincerely hope. That would be tragic."Apparently, today's leap day is causing a denial of serviceerror being able to log into our Cemetery Management softwaredue to some bad date calculations," writes Steve D. To be fair, he points out, it doesn't happen often.
CodeSOD: A Few Updates
Brian was working on landing a contract with a European news agency. Said agency had a large number of intranet applications of varying complexity, all built to support the news business.Now, they understood that, as a news agency, they had no real internal corporate knowledge of good software development practices, so they did what came naturally: they hired a self-proclaimed "code guru" to built the system.Said code guru was notoriously explosive. When users came to him with complaints like "your system lost all the research I've been gathering for the past three months!" the guru would shout about how users were doing it wrong, couldn't be trusted to handle the most basic tasks, and "wiping your ass isn't part of my job description."With a stellar personality like that, what was his PHP code like?
CodeSOD: You Need an Alert
Gabe enjoys it when clients request that he does updates on old software. For Gabe, it's exciting: you never know what you'll discover.
CodeSOD: A Split Purpose
Let's say you had input in the form of field=value, and you wanted to pick that "value" part off. In C#, you'd likely just use String.Split and call it a day. But you're not RK's co-worker.
CodeSOD: Climbing Optimization Mountain
"Personal Mountains" was hearing dire rumors about one of the other developers; rumors about both the quality of their work and their future prospects at the company. Fortunately for Personal Mountains, they never actually had to work with this person.Unfortunately, that person was fired and 30,000 lines of code were now Personal Mountains' responsibility.Fortunately, it's not really 30,000 lines of code.
Error'd: Hard Daze Night
It was an extraordinarily busy week at Error'd HQ.The submission list had an all-time record influx, enough for a couple of special edition columns. Among the list was an unusual PEBKAC. We don't get many ofthese so it made me chuckle and that's really all it takes to get a submission into the mix.Headliner Lucio Crusca perseverated "Here's what I found this morning, after late night workingyesterday, sitting on my couch, with my Thinkpad on my lap.No, it was not my Debian who error'd. I'm afraid it was me."
CodeSOD: The Default Path
I've had the misfortune to inherit a VB .Net project which started life as a VB6 project, but changed halfway through. Such projects are at best confused, mixing idioms of VB6's not-quite object oriented programming with .NET's more modern OO paradigms, plus all the chaos that a mid-project lanugage change entails. Honestly, one of the worst choices Microsoft ever made (and they have made a lot of bad choices) was trying to pretend that VB6 could easily transition into VB .Net. It was a lie that too many managers fell for, and too many developers had to try and make true.Maurice inherited one of these projects. Even worse, the project started in a municipal IT department then was handed of to a large consulting company. Said consulting company then subcontracted the work out to the lowest bidder, who also subcontracted out to an even lower bidder. Things spiraled out of control, and the resulting project had 5,188 GOTO statements in 1321 code files. None of the code used Option Explicit (which requires you to define variables before you use them), or Option Strict (which causes errors when you misuse implicit data-type conversions). In lieu of any error handling, it just pops up message boxes when things go wrong.
CodeSOD: Route to Success
Imagine you're building a PHP web application, and you need to display different forms on different pages. Now, for most of us, we'd likely be using some framework to solve this problem, but even if we weren't, the obvious solution of "use a different PHP file for each screen" is a fairly obvious solution.Dare I say, too obvious a solution?What if we could have one page handle requests for many different URLs? Think of the convenience of having ONE file to run your entire application? Think of the ifs.
CodeSOD: Merge the Files
XML is, arguably, an overspecified language. Every aspect of XML has a standard to interact with it or transform it or manipulate it, and that standard is also defined in XML. Each specification related to XML fits together into a soup that does all the things and solves every problem you could possibly have.Though Owe had a problem that didn't quite map to the XML specification(s). Specifically, he needed to parse absolutely broken XML files.
Representative Line: From a String Builder
Inheritance is one of those object-oriented concepts that creates a lot of conflicts. You'll hear people debating what constitutes an "is-a" versus a "has-a" relationship, you'll hear "favor composition over inheritance", you'll see languages adopt mix-in patterns which use inheritance to do composition. Used well, the feature can make your code cleaner to read and easier to maintain. Used poorly, it's a way to get your polymorphism with a side of spaghetti code.Greg was working on a medical data application's front end. This representative line shows how they use inheritance:
Error'd: Mirror mirror
An abstitution, an assortment, time travel, bad language, and an error'd.First up,Jeremy Pereira pushes the boundaries of this column by sharing something right."Sort of an anti-WTF. It took them 44 minutes to realise they'd made a boo-boo."They probably were notified, but it's still pretty goodtime to repair. Especially considering the issues we knowof that last for years and years.
CodeSOD: While Nothing
Jose received a bit of VB .Net UI code that left him scratching his head.
A Stalled Upgrade
It was time to start developing version 2 of Initech's flagship software product. This meant planning meetings. So many planning meetings.The most important one, for the actual development team, was the user story meeting. The core of these meetings was a few folks from the programming team, including Steve, the director of architecture, Brian, and a variety of product owners, responsible for different segments of the overall product.As a group, they'd review the user stories, and approve them. Once they were approved for development, work would begin.The meetings were difficult to schedule, because of the number of stakeholders, and they were viewed as a checkpoint- you can't start implementing features until the product owner has walked through the user story with the team, but they were also a priority.At the meeting, product owner Renee started walking the team through some of the features she owned. "So, here's my user, Fred Flinstone." Her slide popped up an image of the animated character next to a set of bullet points describing the feature. "He needs to add an item into inventory, so that it can actually be sold. To do that..."Renee walked them through the details of the feature. Heads nodded around the table- it was a pretty straightforward CRUD application. It was good that the product owner walked them through a few workflow things unique to Initech's product, but there wasn't anything particularly shocking.Renee advanced to the next slide. "And now, Fred needs to run a report. This report needs to..."Again, Renee walked them through the key fields that needed to be on the report, how the report was triggered, what the reasonable filtering options would be."Any questions?"Brian, the director, looked thoughtful for a moment, and then said, "I think I do. I can't really see a reason why one person would want to both add items to inventory- a receiving job- and run reports on inventory consumption. There's no reason someone doing the task would also need to run the report. I can't accept your user stories until you change one of the users to be a different person.""What? The name doesn't matter," Renee protested."We should probably just stick a pin in this and pick up when we can reschedule another meeting. Thank you everyone," Brian said. He grabbed his laptop, stood, and left the meeting. Everyone sat there for a moment, realized the meeting was actually over, and followed him out a few minutes later.That afternoon, Steve finally managed to find Brian. "What the heck was that?"Brian sighed. "Look, the entire development team is swamped, you know it. We don't have bandwidth to take on new work. Tracey should have that priority-one bug done in a few days, and maybe once that's done we can start putting resources on the the version 2 project. For now, we need to stall, and that was the only thing I could think of." [Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.
Representative Line: A Memory of Strings
As we saw yesterday, padding can be hard.Jasmine received a set of tickets all complaining that the file download portion of an ASP .Net application took too long. Users frequently had to wait for up to 15 minutes before their browser finished downloading the output of the web application.This particular module generated the file by doing a set of Response.Writes to build the file as part of the HTTP response. This particular line ran 200,000 times in the process of creating the file:
CodeSOD: Timestamped File Name
It's been a minute since some bad date handling code. Wesley inherited this C# blob which exists to generate timestamped filenames.
Error'd: ROUS
I don't think they exist.ChoosyChris P. wants more choices, carping "You keep using that word, I don't think it means what you think it means."
A Bit About the HP3000
Today's anonymously submitted story is a case where the WTF isn't the code itself, per se. This arguably could be a CodeSOD, and we'll get to the code, but there's so much more to the story.Our submitter, let's call them Janice, used to work for a financial institution with a slew of legacy systems. One such system was an HP3000 minicomputer. "Mini", of course, meant "refrigerator sized".The HP3000 itself is an interesting, if peripheral story, because it's one of the tales of a product launch going incredibly wrong. Let's talk a little history.We start with the HP2100 in 1966, which Hewlett Packard did nothing to design, and instead purchased the company that designed it. The core innovation of the HP2100 was that it was architecturally similar to a PDP-8, but supported full 16-bit memory, instead of PDP's 12-bit.HP didn't really know what they had bought- they marketed it as a "test and instrumentation" system, and were surprised when businesses purchased it for back office operations. They ended up with one of the most popular minicomputers for office use, despite it not being designed for that purpose.Thus began the projects "Alpha" and "Omega". Alpha was a hardware refresh of the 2100, with a better memory model. Omega was a ground-up redesign for 32-bit memory, which would allow it to support a whopping 4MB of RAM. There was just one problem with the Omega design: they didn't have funding to actually finish it. The project was killed in 1970, which threw some of the staff into "wear black armbands to work" levels of mourning.Unfortunately, while work was done on Omega, the scope of Alpha crept, which resulted in another project management wasn't sure could be delivered. But the market was there for a time-sharing minicomputer, so they pressed on despite the concerns.The HP2000-line had time sharing system that used multiple processors. There was a front-end processor which handled user interactions. Then there was the actual CPU, which ran programs. This meant that time-sharing was simplified- the CPU just ran programs in a round-robin fashion, and didn't have to worry about pesky things like user inputs. Essentially, it was really just a batch processing system with a multi-user front-end.The designers of Alpha wanted to support full multiprogramming, instead of this hybrid-ish model. But they also needed to support traditional batch processing, as well as real-time execution. So the team split up to build the components of the "Multi-Programming Executive" module, which would allow all of these features.The Alpha, which was still 16-bit, didn't have the luxurious 4MB of RAM- it had 128kB. The MPE used much more memory than 128kB. This led to a massive crunch as the programmers worked to shrink MPE into something usable, while marketing looked at the deadlines and said, "We were supposed to be selling this thing months ago!"The result was a massive war between engineering and marketing, where marketing gave customers promises about what the performance would be, engineering told marketing what the actual performance would be (significantly worse than what marketing was promising), and then management would demand engineering "prove" that marketing's over-promises could be met.The initial ship-date was November, 1972, and by god, they shipped on time. Nothing actually worked, but they shipped. The first computer out the door was returned almost immediately. It could only handle two simultaneous users before slowing to a crawl, and crashed every ten minutes. By December, HP had gotten that to "crashes every two hours". They kept shipping machines even as they had to cut features and reliability promises.Those frequent crashes also concealed another bug: after running for 24 days, the HP3000's clock would overflow (2^31 milliseconds) and the clock would magically reverse by 25 days. As one sysop of a purchased HP3000 put it: "The original designers of MPE never thought the OS would stay up for 25+ days in a row".After a bunch of management shuffling, the titular Packard of Hewlett Packard sent a memo: production was stopping and all sold computers were being recalled. Customers were offered HP2000s in its place, or they could wait until fall 1973 for a revised version- that would only support 4-6 users, far fewer than marketing's initial promises of 64. This pleased no one, and it's reported that some customers cried over the disappointment.With sales paused, the entire computer underwent a design overhaul. The resulting machine was faster and cheaper and could actually handle 8 simultaneous users. One year after the botched launch, the HP3000 went back on the market, and ended up being a full success.It was so successful, HP continued supporting the HP3000 until 2010, which is where Janice enters our story. Circa 2006, she needed to update some Pascal code. That code used a lot of bit-masks to handle flags, which is normally a pretty easy function in Pascal- the language has a standard set of bitwise operations. So Janice was surprised to see:
CodeSOD: Return Country
Let's say you have a database table containing a list of countries. Given the primary key of a country in that table- an arbitrary ID field- you need to look up the name of that country.Curtis's predecessor dropped this solution:
CodeSOD: Max Character Width
One of the "features" of the Oracle database is that, in addition to the "wonderful" PL/SQL language for building stored procedures, you can also write stored procedures in Java.Now, the skills of "being a good database programmer" and "being a good Java programmer" are not necessarily overlapping, especially when you're deep in the world of Oracle's approach to programming. Which is where this submission, from Tomas comes from.
A Laboratory Upgrade
Unfortunately for Elena, the laboratory information management system (LIMS) her team used was being sunsetted by the vendor, Initech. She's a biochemist working in a pathology department, and this software is vital to tracking the tests need, the tests already run, and providing critical notifications about abnormal test results.Since Initech was sunsetting that product, the hospital system put out an RFQ for a replacements, and after a multi-year bidding process, offered the contract for replacing the software to Initech.And thus, IniLab went away, and was replaced by IniHeal. Gone was the classic terminal interface that everyone had learned to use, and in its place was a "user friendly" GUI- a GUI that buried functionality behind fifteen clicks, had no meaningful keyboard shortcuts, and was constantly changing as they pushed updates, making it impossible to adjust to.Also gone was the IniLab scripting language. IniLab's scripting language was how they had assembled workflows for laboratory processes. You could have fine grained control of which scripts tied to which kinds of tests, and even build custom workflows as one-offs, if necessary. They had many thousands of lines of code that needed to be ported over into IniHeal. The problem was IniHeal's approach to scripting was... well, bad.First, IniHeal doesn't allow you write scripts. Instead, it has a pair of "rule" files. The marketing copy calls these "declarative", and promises that they're an upgrade. In practice, these are gigantic files that contain a set of rules that are evaluated for every test and every sample.But the worse problem in IniHeal is how it lets you handle data. In IniLab, if you wanted the patient's age, you might reference the field by name: Patient.age. In IniLab, you need to use the PPPPLL. What is the PPPPLL?PPPPLL stands for "position" and "length". Instead of referencing a field by name, you have to reference the field by its byte offset and length. So Patient.age might be [091001]. And no, there's no easy way to create constants or variables to hold your PPPPLLs, you just have to know that [091001] is age, and hope that the input data never changes its layout.Now, one of the things Elena noticed while techs were on-site is that the length of the date time fields was 32 bits, and the data was seconds since the Unix epoch. So she asked one of the senior developers "Hey, is this software Year 2038 safe?"The developer laughed. "I'll be retired by then."The final insult to injury is that this software wasn't installed on any laboratory workstations. Instead, they had to use Remote Desktop to access it inside of a VM. While the environment was theoretically locked down so that the only program you could run was IniHeal, in practice it was trivially easy to get to a desktop inside the VM.Curious, Elena poked around. She not only found the installation logs from her lab's deployment, but the installation logs from several other labs. These logs included various internal and private details, including account passwords. Somehow, log files from client installs had ended up in their installation media and were deployed to every client site.Elena reported the potential data breach. The final finding was that the password in question was long defunct, which led management to decide "well, that's no problem then."IniHeal has a slogan about equipping customers with innovative tools, but Elena proposes a new one:"The Q in IniHeal is for Quality." [Advertisement] ProGet's got you covered with security and access controls on your NuGet feeds. Learn more.
Error'd: Groundhog Day
In this week's episode we have some moreadventures in shipping and misadventures with dates.I justasked "Hey Google, how many days are therein February THIS year" and they answered confidently "28 days."I briefly considered autoplaying that query on this page to seehow many of your devices would answer correctly, but then Idecided I should autoplay a command to order me a pizza andthen I thought better of the whole thing.Following up on an earlier submission,Dave P. reports"Much to my amazement, the package did arrive in time for Christmas, but just barely. USPS really came through on their end, taking less than 2 days to deliver the package,after the original delivery service took 12 days to find the USPS dropoff facility."Hah! Somebody owes me a nickel!
CodeSOD: A Well Known Address
Amanda's company wanted to restrict access to a service by filtering on the requestor's IP address. Yes, this is a terrible idea. So they wanted to make it a bit smarter, and also filter on various subnets. But they had a LOT of different subnets.So the result was this:
CodeSOD: A Voice Map
Let's say your company wanted to offer special deals. When a customer calls about one of these deals, you want to play an automated customer support message using SignalWire, a tool for scripting phone voice trees.This is a natural case for using a Map data structure. Which is what Ajay's predecessor did. They just... uh... weren't sure how to use a Map.
CodeSOD: 2019 Was a Fine Year
Efren's employer recently acquired a competitor. The competitor had been struggling for a number of years, and the acquisition was a last ditch attempt to preserve at least some of the business (a complete closure was the only other option).Now, "struggling for a number of years" sounds fairly vague, but due to some bad database design, we actually have a clear indicator of exactly when the company gave up:
CodeSOD: Bent Struts
Luke has inherited a Java Struts-based application. Struts is one of the many Java web frameworks, designed around having HTTP requests trigger actions- that is routing HTTP requests to a specific function call.Now, on one screen, the user filled in a form, and then the corresponding action on the server side needed to read the form data for an eventId and act upon it. In Struts, this can be very simple:
Error'd: Ride Ride Ride
File under "Old Business": Swissrail just can't catch a break.Diligent Richard B. dug into the news and reports"After following the link from this week's Error'd, I cameacross this interesting description in Swissrail's Member list.The filename means 'Company description En(glish)'.They have the same thing in French; the German description is normal."
CodeSOD: Control Tree
User interfaces tend to map fairly naturally to trees as a data structure. In the modern world where we've forgotten how to make native UIs and do everything as web applications pretending to be native, the "tree" model is explicit via the DOM. But even in native UIs, we tend to group controls into containers and panels and tabs.Now, there may be cases where we need to traverse the tree, and trees present us with a very natural way to traverse them- recursion. To search the tree, first search the subtree. Recursion can have its own problems, but the UI tree of a native application is rarely deep enough for those problems to be an issue.Nick inherited some VB .Net code that iterates across all the controls in the screen. It does not use recursion, which isn't a problem in and of itself. Every other choice in the code is the problem.
CodeSOD: Replacing a City
Mateus inherited some code where half the variables were named things like strAux1 and strAux2. It was a data driven application, and the data had some conventions that weren't always ideal; for example, every city also had an associated abbreviation stored in its name field, e.g., "SAO PAULO (SP)" and "RIO DE JANEIRO (RJ)".The original developers wanted to be able to present the names of cities without the abbreviation, so they wrote this:
CodeSOD: Name a Valid Email
Correctly validating an email address, per the spec, is actually surprisingly hard. This is, in part, because there are a lot of features in the email address that nobody ever uses. Even so, you can easily get close enough with basic regex, and that's what most people do.Niels H's predecessor wanted to go a little farther. They wanted to ensure that the supplied domain name had a valid DNS entry. Overkill? Probably. But, fortunately for them the .NET framework supplies a handy System.Net.Dns.GetHostEntry method, which resolves a domain name. That at least makes the problem easy to solve.It makes the problem easy to solve if you use it. But why use a built in method when you can do it yourself?
CodeSOD: Pretty POed
"QPirate" was debugging an issue with purchase order version information. The format was supposed to be "Revision#.Version#", essentially "major" and "minor" versions for the various steps as the purchase order wormed its way through the company's incredibly complicated purchasing process.Unfortunately, that isn't what was happening. Many numbers behaved in unexpected ways when they were versioned too many times. QPirate dug in, and found this:
Error'd: Grasshopper
One of my multitude of peeves is the phrase "special characters." Somehow,our lexicon has been corrupted by semiliterate middle-schoolers,who have never learned that the name for ,.;: and so on ispunctuation and/or symbol. Dustin Hoffman's Raymondwas a special character. Period ain't.This week,Robert F. had the misfortunate to step into it, and observed "What boggles my mind is that someone had to activelychoose to create a validation rule specifically for this."
CodeSOD: Get Results as What?
Before RESTful web services and JSON as a serialization format, XML was going to conquer the world. Circa 2001, I remember going to user's groups only to hear about how XML was going to allow legacy mainframes to be connected to modern applications (without discussing the fact that the legacy mainframe still needed maintenance and code support). These days, XML is (nearly) dead, and lighter-weight markup languages have replaced it, including JSON.Which brings us to this method, from Chris:
A Continental Divide
Our friend Argle has shared a great many stories with us. Today's story is one that Argle relates secondhand, about one of Argle's former students: Marie.Marie was a prized student, and kept in touch with Argle after classes. At various points, they were co-workers at other companies, or when Argle founded his startup, Marie was one of the first hires. In between those points where their career paths converged, they kept in touch, even visiting each other at work.For a few years, Marie ended up in Initech's telecom division. Her office was not in the traditional cube farm, but a small room (with a door and everything!) buried in the basement, far from windows. It may have been a bit of a dank, ugly, cave, but Marie, like all of her fellow Morlocks, did what she could to make it more homey.Given the era, and the specific computer-nerd subculture, that meant a lot of the ThinkGeek-style desk toys and posters. A Netwon's cradle over there, a fossilized shark's tooth there, and on the wall a Firefly poster sandwiched between a "Reunite Gondwonaland" poster and a "Pangean Liberation Front" poster. It wasn't much, but it was a home away from home.For months, everything was happy, or as happy as one can be in a basement cave in at Initech. At some point, a new manager was hired, took a tour of the basement, introduced himself, and shook everybody's hand. Well, everybody's hand but Marie's.Later that day, when she popped out of the Underdark to forage for lunch at the taco place down the street, she saw the new manager huddled up with the older managers, whispering to themselves around the coffee maker. When she passed by, they clammed up until she was back out of ear shot.When Marie returned to her desk, there was an email waiting for her- she was to report to the office of her Two Levels Up boss immediately. That couldn't be good. She dutifully trudged to that office. That triggered a call for all the other implicated managers on the team, and before long a half dozen people were crammed into this single office with stern looks on their faces."It's come to our attention that you've been displaying... inappropriate items in your office." "Flagrantly!" "Potentially offensive!" "Inappropriate for work, certainly, but also inappropriate for anywhere else!" "Blatantly political items are inappropriate for company owned spaces."The managers, in chorus, explained to her letter and verse exactly which sections of the employee manual she had violated, and exactly what those consequences were going to be. What they didn't explain was how exactly she had violated them."I'm confused, what items am I displaying that are blatantly political?""Why, those posters!" New Manager said. "Not just blatantly political, but also offensive to many of your co-workers."Marie was aware that Firefly's cancellation had been cause for much outcry amongst its fans, but didn't see how that was political- and then she realized that it was the other two posters: "Reunite Gondwonaland" and "Pangean Liberation Front" that had drawn their ire.Marie could have, at that point, defended herself. She could have explained the joke (which always makes it funnier), and attempted to explain geology and continental drift to a horde of managers that had already worked themselves into a frenzy over things they didn't understand. And while she would have been right, it certainly wouldn't have won her anything, and would likely have made the situation worse.So instead, she said, "Oh, I'm sorry, I didn't realize. I'll take them down." After a little more scolding, she was released to go back to her cave, where she did what she promised, packing the posters neatly into the original packing tubes they'd come in. And after that, she touched up her resume- it wasn't going to be hard to find a place where she could express herself "politically". [Advertisement] Continuously monitor your servers for configuration changes, and report when there's configuration drift. Get started with Otter today!
CodeSOD: Clear This
Andy found this simple function in a C project he's working on.
CodeSOD: A Simple List Copy
Mike's team had a new hire. They did great on the interview, really shined in the coding challenges, so it was a no-brainer hire. In the middle of on-boarding, the team got slammed, so this new hire ended up being left to fend for themselves.This was a mistake.
Error'd: Patience
Surprise-hating Adam R. worries"I thought I ordered some outdoors gear, but apparentlyI'm receiving some not valid today. I hope I don't geta box full of surprises!" I get it Adam; I don't likesurprises either. But they're better than spiders.
CodeSOD: The End of Time
We often talk about dates and timekeeping as extraordinarily difficult tasks. And, at least in part, that may have to do with their origins as legacy technologies in the most legacy sense: we have strong evidence of calendar systems all the way back into the Neolithic period, and maybe some hints of them as far back as the Paleolithic. Literally, stone age technology, still in use today.I wonder if that's why calendar's hold such a mystical hold over us? Many of us likely remember the New Age predictions that 2012 was going to mark the end of the world or some great reconfiguration of the world, simply because it marked the end of a cycle in the Mayan Calendar. Before that, prophecies centered on the year 2000, not just because of the Y2K bug, but simply because it's a round number and people felt like that's a good place to call it. Before that, there was the astrological predictions of the Age of Aquarius (which may fall anywhere from 1844 to sometime in the 24th century, but was real popular for a minute in the 60s and 70s). And we can walk farther back into history, finding eschatological predictions centered around significant dates.Will some future society see the Y2K38 bug as a similar marker of the End TimesTM? And when that passes, will they turn to this prediction, found in Etienne's codebase?
Contracting: Enterprise Edition
After a move to another city, Philip found himself looking for work. Fortunately, a contract came his way. The money was good, the customer was a large bank. At the time, Philip's only regret was that it was a 6-month contract- something longer would have helped him get settled in his new home.The first week of those six months were spent waiting for the operations team to provision him a Citrix environment- developers weren't given laptops, they were given dumb terminals that connected to a canonical dev environment hosted in Citrix. So, for one week, Philip did nothing but sit at a desk for 8 hours. He didn't have a laptop, and as a bank they had strict rules about personal devices being used, so he couldn't even use his phone.Once Philip had an environment, he was able to start looking at the code. He knew he had signed up to work in a Java shop, but was quite surprised to discover it was a J2EE shop. Starting in 2006, J2EE became Java EE, which eventually became Jakarta EE. But this project started in 2015, well past J2EE's expiration date. "Do I have the right code?" he asked, wondering if he had pulled the wrong version or the wrong product or something."Nope, that's it," one of his new co-workers replied."Ah, so, uh... where are the tests? That'll help be learn the codebase?"The new co-worker blanched and turned straight back to their computer. Barry, Philip's new manager, tapped Philip on his shoulder. "Why don't you come with me?"Barry lead Philip to his office, where another manager was already waiting. "Who told you that you could write tests?" Barry glowered at Philip, while Philip tried to parse that question. Who had told Philip he could write tests? Common sense? Basic programming practices?"You're a developer," Barry explained, "and we're paying you a not insignificant amount of money to be a developer. If we wanted you to be a tester, we'd have hired a tester. Use your time here responsibly, and maybe this contract can become a temp-to-hire. Now get back to work. Get back to developing."The dev environment in Citrix didn't have the J2EE container installed- they used WebSphere- so Philip had no way to actually run his code. It took another two weeks to get permissions to install the required software, and their copy of WebSphere was distributed as a zip file stored on a shared network drive.A month into his 6 month contract, Philip was finally able to pick up a ticket, do some work, and see the results.And then Barry pulled him into another meeting: "Why do we have a copy of WebSphere in Citrix now? There's a test server, you're just supposed to put your code there.""There's a dozen developers, and one test server.""And?" Barry asked, impatiently. "Just take turns. We're going to reset your Citrix environment, and don't do that again."At the end of Philip's six month contract, he was not offered an extension or an option for full time employment. He was just glad it was only six months, and made a note to never work for that company ever again. [Advertisement] Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!
CodeSOD: Exceptionally Backwards
"Generic exception handlers" sound like an oxymoron, but are a weirdly common pattern in web development. ASP .NET, for example, has a global.asax file, which can contain an Application_Error method. In practice, this is meant to handle all the otherwise unhandleable errors- each individual endpoint should still do exception handling for all the errors it can, but the errors that are impractical to handle locally, like the database being inaccessible, bubble up to your generic handler.Of course, it's important that the generic handler actually handle the exception. Which brings us to George's submission, an ASP .Net error handler.
CodeSOD: The Chosen Solution
Error'd: One If By Land
It's a new year, but Error'd never changes. Still (mostly) thesame contributors, still the same reliable return of NaNs,nulls, out of sorts sorts, bad date math, and a slavishadherence to the Oxford comma and two spaces after periods.MFC (Most Faithful Contributor)Michael R. sings "Love remains even after the event is over at Tixel."
CodeSOD: Just One Check
Christian works on an application that has some unusual conventions. For example, while I've seen many a codebase that Hungarians their private member variables like _myPrivateMember, his team did the opposite: myPrivateMember_.Someone on the team had a problem: they needed to verify that at least one checkbox was checked. This was their solution to that, in C#:
CodeSOD: A Type of HPC
Matteo's company hired a Highly Paid Consultant. The HPC came in, took one look at their C# codebase, and said, "You're doing everything wrong. But don't worry, I can fix it!"So he "fixed" it.For example, what if you had a string, and needed to parse it to some concrete type. Why, you just do this:
CodeSOD: Making the Thingie Work
Alyssa inherited some code from... well, she isn't entirely sure from whom. There are names that come up in git blame, but even for some more recent commits, Alyssa has no idea who they are. Contractors? Interns? Randos pulled in off the street and handed a keyboard?Based on the code quality, the last option is surprisingly likely.
Best of…: Best of 2023: A Single Bug
12345678910...