by Remy Porter on (#6MB64)
Ulvhamne sends us some bad code that, well, I think at this point we should really coin a name for this particular anti-pattern.
|
The Daily WTF
Link | http://thedailywtf.com/ |
Feed | http://syndication.thedailywtf.com/TheDailyWtf |
Updated | 2024-11-21 14:46 |
by Remy Porter on (#6MA7N)
Bob's employer had a data-driven application which wasn't performing terribly well. They had some in-house database administrators, but their skills were more "keep things running," and less "do deep optimizations". The company opted to hire a contract DBA to come in, address the performance problems, and leave.In actual fact, the DBA came in, ran some monitoring, and then simply wrote some guidance- generic, and frankly useless guidance. "Index on frequently queried fields," and "ensure database statistics are gathered on the appropriate schedule."The only meaningful output of the contractor's visit was a list of the badly performing stored procedures. Bob was given the list and told, "Go fix these."One stored procedure needed to populate variables with data from the order table. Specifically, it needed to collect sender_id, user_group, and file_ref from the orders table. Here's how it did that:
|
by Remy Porter on (#6M9AG)
Marcus's team was restructuring the API, and the architect thus wanted a number of methods marked obsolete, to encourage developers to move to the new version of the API. So the architect created a Jira task, assigned it to a dev, and moved on.Somehow, this C# code got committed and merged, despite being code reviewed:
|
by Remy Porter on (#6M8EE)
As oft discussed, null-terminated C-style strings are an endless source of problems. But there's no problem so bad that it can't be made worse by a sufficiently motivated developer.Today's rather old code comes from Mike, who inherited an old, MFC application. This code is responsible for opening a file dialog, and the key goal of the code is to configure the file filter in that dialog. In MFC, this is done by passing a delimited string containing a caption and a glob for filtering. E.g., "Text Files (.txt) | *.txt" would open a dialog for finding text files.
|
by Lyle Seaman on (#6M6P9)
This week we have a special visit from a mythical beast: the snarklemma. But first, a non-error Error'd.Obsessive Optimizer Ian K."Walmart's nationwide network of warehouse stores meansthey can save time and money by shipping locally. FedExhas them covered: Their nationwide shipping fleet determinedthe shortest path from Houston to its largest suburb goes via Georgia."Not the shortest path, nor the fastest, but surely the cheapest one that meets the delivery date requirement. It's probably not an error, and I believe it, but I still can't believe it!
|
by Remy Porter on (#6M5SK)
Yesterday we talked about bad CSS. Today, we're going to talk about bad HTML.Corey inherited a web page that, among other things, wanted to display a bulleted list of links. Now, you or I might reach for the ul element, which is for displaying bulleted lists. But we do not have the galaxy sized brains of this individual:
|
by Remy Porter on (#6M4TX)
There is a surprising amount of debate about how to use CSS classes. The correct side of this debate argues that we should use classes to describe what the content is, what role it serves in our UI; i.e., a section of a page displaying employee information might be classed employee. If we want the "name" field of an employee to have a red underline, we might write a rule like:
|
by Remy Porter on (#6M3X6)
Once upon a time, I was tuning a database performance issue. The backing database was an Oracle database, and the key problem was simply that the data needed to be partitioned. Great, easy, I wrote up a change script, applied it to a test environment, gathered some metrics to prove that it had the effects we expected, and submitted a request to apply it to production.And the DBAs came down on me like a sledgehammer. Why? Well, according to our DBAs, the license we had with Oracle didn't let us use partitioning. The feature wasn't disabled in any way, but when an Oracle compliance check was performed, we'd get dinged and they'd charge us big bucks for having used the feature- and if we wanted to enable it, it'd cost us $10,000 a year, and no one was willing to pay that.Now, I have no idea how true this actually was. I have no reason to disbelieve the DBAs I was working with, but perhaps they were being overly cautious. But the result is that I had to manually partition the data into different tables. The good news was all the writes always went into the most recent table, almost all of the reads went to either the current table or last month's table, and everything else was basically legacy and while it might be used in a report, if it was slower than the pitch drop experiment, that was fine.It was stupid, and it sucked, but it wasn't the worst sin I'd ever committed.Which is why I have at least some sympathy for this stored procedure, found by Ayende.
|
by Remy Porter on (#6M304)
As oft stated, the specification governing email addresses is complicated, and isn't really well suited for regular expressions. You can get there, but honestly, most applications can get away with checking for something that looks vaguely email like and call it a day.Now, as complicated as the "accurate" regex can get, we can certainly find worse regexes for validating emails. Morgan did, while on a contract.The client side had this lovely regex for validating emails:
|
by Lyle Seaman on (#6M18V)
There are an infinite variety of ways to be wrong, but only very small number of ways to be right.PatientPeter W. discovers that MS Word is of two minds about English usage."Microsoft Word just can't seem to agree with itself on how to spell paycheck/pay check."Faithful readers know it's even worse than that.
|
by Remy Porter on (#6M0BH)
So many languages eschew "truth" for "truthiness". Today, we're looking at PHP's approach.PHP automatically coerces types to a boolean with some fairly simple rules:
|
by Remy Porter on (#6KZDH)
Strings in C are a unique collection of mistakes. The biggest one is the idea of null termination. Null termination is not without its advantages: because you're using a single byte to mark the end of the string, you can have strings of arbitrary length. No need to track the size and worry if your size variable is big enough to hold the end of the string. No complicated data structures. Just "read till you find a 0 byte, and you know you're done."Of course, this is the root of a lot of evils. Malicious inputs that lack a null terminator, for example, are a common exploit. It's so dangerous that all of the str* functions have strn* versions, which allow you to pass sizes to ensure you don't overrun any buffers.Dmitri sends us a simple example of someone not quite fully understanding this.
|
by Bobby T. Johnson on (#6KYHC)
Gloria was a senior developer at IniMirage, a company that makes custom visualizations for their clients. Over a few years, IniMirage had grown to more than 100 people, but was still very much in startup mode. Because of that, Gloria tried to keep her teams sized for two pizzas. Thomas, the product manager, on the other hand, felt that the company was ready to make big moves, and could scale up the teams: more people could move products faster. And Thomas was her manager, so he was "setting direction."Gloria's elderly dog had spent the night at the emergency vet, and the company hadn't grown up to "giving sick days" yet, so she was nursing a headache from lack of sleep, when Thomas tried to initiate a Slack huddle. He had a habit of pushing the "Huddle" button any time the mood struct, without rhyme or reason.She put on her headphones and accepted the call. "It's Gloria. Can you hear me?" She checked her mic, and repeated the check. She waited a minute before hanging up and getting back to work.About five minutes later, Thomas called again."Hey, did you call me like 10 minutes ago?""No, you called me." Gloria facepalmed and took a deep, calming breath. "I couldn't hear you."Thomas said, "Huh, okay. Anyway, is that demo ready for today?"Thomas loved making schedules. He usually used Excel. There was just one problem: he rarely shared them, and he rarely read them after making them. Gloria had nothing on her calendar. "What demo?""Oh, Dylan said he was ready for a demo. So I scheduled it with Jack."Jack was the CEO. Dylan was one of Gloria's peers. Gloria checked Github, and said, "Well, Dylan hasn't pushed anything for... months. I haven't heard anything from him. Has he showed you this demo?"Gloria heard crunching. Thomas was munching on some chips. She heard him typing. After a minute, she said, "Thomas?""Oh, sorry, I was distracted."Clearly. "Okay, I think we should cancel this meeting. I've seen this before, and with a bad demo, we could lose buy in."Thomas said, "No, no, it'll be fine."Gloria said, "Okay, well, let me know how that demo goes." She left the call and went back to work, thinking that it'd be Thomas's funeral. A few minutes before the meeting, her inbox dinged. She was now invited to the demo.She joined the meeting, only to learn that Dylan was out sick and couldn't make the meeting. She spent the time giving project updates on her work, instead of demos, which is what the CEO actually wanted anyway. The meeting ended and everyone was happy- everyone but Gloria.Gloria wrote an email to the CEO, expressing her concerns. Thomas was inattentive, incommunicative, and had left her alone to manage the team. She felt that she was doing more of the product management work than Thomas was. Jack replied that he appreciated her concerns, but that Thomas was growing into the position.Julia, one of the other product managers, popped by Gloria's desk a few weeks later. "You know Dylan?"Gloria said, "Well, I know he hasn't push any code in a literal year and keeps getting sick. I think I've pushed more code to his project than he has, and I'm not on it."Julia laughed. "Well, he's been fired, but not for that."Thomas had been pushing for more demos. Which meant he pulled Dylan into more meetings with the CEO. Jack was a "face time" person, and required everyone to turn on their webcams during meetings. It didn't take very many meetings to discover that Dylan was an entirely different person each time. There were multiple Dylans."But even without that, HR was going to fire him for not showing up to work," Julia said."But... if there were multiple people... why couldn't someone show up?" Gloria realized she was asking the wrong question. "How did Thomas never realize it?"And if he was multiple people, how could he never get any work done? Dylan was a two-pizza team all by himself.After the Dylan debacle, Thomas resigned suddenly and left to work at a competitor. A new product manager, Penny, came on board, and was organized, communicative, and attentive. Gloria never heard about Dylan again, and Penny kept the team sizes small. [Advertisement] Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.
|
by Remy Porter on (#6KXMY)
It's incredibly common to convert objects to dictionaries/maps and back, for all sorts of reasons. Jeff's co-worker was tasked with taking a dictionary which contained three keys, "mail", "telephonenumber", and "facsimiletelephonenumber" into an object representing a contact. This was their solution:
|
by Lyle Seaman on (#6KVZG)
A twitchy anonymous reporter pointed out that our form validation code is flaky. He's not wrong. But at least it can report time without needing emoticons! :-3That same anon sent us the following, explaining"Folks at Twitch are very brave. So brave, they wrote their own time math."
|
by Remy Porter on (#6KV2G)
In the late 90s into the early 2000s, there was an entire industry spun up to get businesses and governments off their mainframe systems from the 60s and onto something modern. "Modern", in that era, usually meant Java. I attended vendor presentations, for example, that promised that you could take your mainframe, slap a SOAP webservice on it, and then gradually migrate modules off the mainframe and into Java Enterprise Edition. In the intervening years, I have seen exactly 0 successful migrations like this- usually they just end up trying that for a few years and then biting the bullet and doing a ground-up rewrite.That's is the situation ML was in: a state government wanted to replace their COBOL mainframe monster with a "maintainable" J2EE/WebSphere based application. Gone would be the 3270 dumb terminals, and here would be desktop PCs running web browsers.ML's team did the initial design work, which the state was very happy with. But the actual development work gave the state sticker shock, so they opted to take the design from ML's company and ship it out to a lowest-bidder offshore vendor to actually do the development work.This, by the way, was another popular mindset in the early 00s: you could design your software as a set of UML diagrams and then hand them off to the cheapest coder you could hire, and voila, you'd have working software (and someday soon, you'd be able to just generate the code and wouldn't need the programmer in the first place! ANY DAY NOW).Now, this code is old, and predates generics in Java, so the use of ArrayLists isn't the WTF. But the programmer's approach to polymorphism is.
|
by Remy Porter on (#6KT5P)
It's good to handle any exception that could be raised in some useful way. Frequently, this means that you need to take advantage of the catch block's ability to filter by type so you can do something different in each case. Or you could do what Adam's co-worker did.
|
by Remy Porter on (#6KS96)
Joe sends us some Visual Basic .NET exception handling. Let's see if you can spot what's wrong?
|
by Remy Porter on (#6KRGS)
April Fool's day is a day where websites lie to you or create complex pranks. We've generally avoided the former, but have done a few of the latter, but we also like to just use April Fool's as a chance to change things up.So today, we're going to do something different. We're going to talk about my Day Job. Specifically, we're going to talk about a tool I use in my day job: cFS.cFS is a NASA-designed architecture for designing spaceflight applications. It's open source, and designed to be accessible. A lot of the missions NASA launches use cFS, which gives it a lovely proven track record. And it was designed and built by people much smarter than me. Which doesn't mean it's free of WTFs.The Big PicturecFS is a C framework for spaceflight, designed to run on real-time OSes, though fully capable of running on Linux (with or without a realtime kernel), and even Windows. It has three core modules- a Core Flight Executive (cFE) (which provides services around task management, and cross-task communication), the OS Abstraction Layer (helping your code be portable across OSes), and a Platform Support Package (low-level support for board-connected hardware). Its core concept is that you build "apps", and the whole thing has a pitch about an app store. We'll come back to that. What exactly is an app in cFS?Well, at their core, "apps" are just Actors. They're a block of code with its own internal state, that interacts with other modules via message passing, but basically runs as its own thread (or a realtime task, or whatever your OS appropriate abstraction is).These applications are wired together by a cFS feature called the "Core Flight Executive Software Bus" (cFE Software Bus, or just Software Bus), which handles managing subscriptions and routing. Under the hood, this leverages an OS-level message queue abstraction. Since each "app" has its own internal memory, and only reacts to messages (or emits messages for others to react to), we avoid pretty much all of the main pitfalls of concurrency.This all feeds into the single responsibility principle, giving each "app" one job to do. And while we're throwing around buzzwords, it also grants us encapsulation (each "app" has its own memory space, unshared), and helps us design around interfaces- "apps" emit and receive certain messages, which defines their interface. It's almost like full object oriented programming in C, or something like how the BeamVM languages (Erlang, Elixir) work.The other benefit of this is that we can have reusable apps which provide common functionality that every mission needs. For example, the app DS (Data Storage) logs any messages that cross the software bus. LC (Limit Checker) allows you to configure expected ranges for telemetry (like, for example, the temperature you expect a sensor to report), and raise alerts if it falls out of range. There's SCH (Scheduler) which sends commands to apps to wake them up so they can do useful work (also making it easy to sleep apps indefinitely and minimize power consumption).All in all, cFS constitutes a robust, well-tested framework for designing spaceflight applications.Even NASA annoys meThis is TDWTF, however, so none of this is all sunshine and roses. cFS is not the prettiest framework, and the developer experience may ah... leave a lot to be desired. It's always undergoing constant improvement, which is good, but still has its pain points.Speaking of constant improvement, let's talk about versioning. cFS is the core flight software framework which hosts your apps (via the cFE), and cFS is getting new versions. The apps themselves also get new versions. The people writing the apps and the people writing cFS are not always coordinating on this, which means that when cFS adds a breaking change to their API, you get to play the "which version of cFS and App X play nice together". And since everyone has different practices around tagging releases, you often have to walk through commits to find the last version of the app that was compatible with your version of cFS, and see things like releases tagged "compatible with Draco rc2 (mostly)". The goal of "grab apps from an App Store and they just work" is definitely not actually happening.Or, this, from the current cFS readme:
|
by Lyle Seaman on (#6KPX7)
We've got some of the rarer classic Error'd types today:events from the dawn of time, weird definitions of space,and this absolutely astonishing choice of cancel/confirm button text.Perplexed Stewart found this and it's got me completely befuddled as well!"Puzzled over this classic type of Error'd for ages. Ireally have no clue whether I should press Yes or No."
|
by Remy Porter on (#6KP4S)
We've seen loads of bad date handling, but as always, there's new ways to be surprised by the bizarre inventions people come up with. Today, Tim sends us some bad date sorting, in PHP.
|
by Remy Porter on (#6KN7Q)
We all know that 2038 is going to be a big year. In a mere 14 years, a bunch of devices are going to have problems.Less known is the Y2030 problem, which is what Ventsislav fighting to protect us from.
|
by Remy Porter on (#6KMAE)
As a general rule, I will actually prefer code that is verbose and clear over code that is concise but makes me think. I really don't like to think if I don't have to.Of course, there's the class of WTF code that is verbose, unclear and also really bad, which Thomas sends us today:
|
by Remy Porter on (#6KKDV)
One of the perks of open source software is that it means that large companies can and will patch it for their needs. Which means we can see what a particular large electronics vendor did with a video player application.For example, they needed to see if the URL pointed to a stream protected by WideVine, Vudu, or Netflix. They can do this by checking if the filename contains a certain substring. Let's see how they accomplished this...
|
by Lyle Seaman on (#6KHR7)
In a first for me, this week we got FIVE unique submissionsof the exact same bug on LinkedIn. In the spirit of the theme,I dug up a couple of unused submissions of older problems atLinkedIn as well. I guess there are more than the usual numberof tech people looking for jobs.John S., Chris K., Peter C., Brett Nash and Piotr K. all sent in samples of this doublebug. It's a flubstitution AND bad math,together!
|
by Remy Porter on (#6KGWY)
Alex saw, in the company's codebase, a method called recursive_readdir. It had no comments, but the name seemed pretty clear: it would read directories recursively, presumably enumerating their contents.Fortunately for Alex, they checked the code before blindly calling the method.
|
by Remy Porter on (#6KFX2)
In the far-off era of the late-90s, Jens worked for a small software shop that built tools for enterprise customers. It was a small shop, and most of the projects were fairly small- usually enough for one developer to see through to completion.A co-worker built a VB4 (the latest version available) tool that interfaced with an Oracle database. That co-worker quit, and that meant this tool was Jens's job. The fact that Jens had never touched Visual Basic before meant nothing.With the original developer gone, Jens had to go back to the customer for some knowledge transfer. "Walk me through how you use the application?""The main thing we do is print reports," the user said. They navigated through a few screens worth of menus to the report, and got a preview of it. It was a simple report with five records displayed on each page. The user hit "Print", and then a dialog box appeared: "Print Page 1? [Yes] [No]". The user clicked "Yes". "Print Page 2? [Yes] [No]". The user started clicking "no", since the demo had been done and there was no reason to burn through a bunch of printer paper."Wait, is this how this works?" Jens asked, not believing his eyes."Yes, it's great because we can decide which pages we want to print," the user said."Print Page 57? [Yes] [No]".With each page, the dialog box took longer and longer to appear, the program apparently bogging down.Now, the code is long lost, and Jens quickly forgot everything they learned about VB4 once this project was over (fair), so instead of a pure code sample, we have here a little pseudocode to demonstrate the flow:
|
by Remy Porter on (#6KEYS)
One would imagine that logging has been largely solved at this point. Simple tasks, like, "Only print this message when we're in debug mode," seem like obvious, well-understood features for any logging library."LostLozz offers us a... different approach to this problem.
|
by Remy Porter on (#6KE4G)
Dave's codebase used to have this function in it:
|
by Lyle Seaman on (#6KC80)
Date problems continue again this week as usual, both sublime (Goodreads!) and mundane(a little light time travel). If you want to be frist poster today, you're going to reallyneed that time machine.Early BirdDave crowed "Think you're hot for posting the first comment? I posted the zeroth reply to this comment!"You got the worm, Dave.
|
by Remy Porter on (#6KB8G)
Rui recently pulled an all-nighter on a new contract. The underlying system is... complicated. There's a PHP front end, which also talks directly to the database, as well as a Java backend, which also talks to point-of-sale terminals. The high-level architecture is a bit of a mess.The actual code architecture is also a mess.For example, this code lives in the Java portion.
|
by Remy Porter on (#6KABY)
Branon's boss, Steve, came storming into his cube. From the look of panic on his face, it was clear that this was a full hair-on-fire emergency."Did we change anything this weekend?""No," Branon said. "We never deploy on a weekend.""Well, something must have changed?!"After a few rounds of this, Steve's panic wore off and he explained a bit more clearly. Every night, their application was supposed to generate a set of nightly reports and emailed them out. These reports went to a number of people in the company, up to and including the CEO. Come Monday morning, the CEO checked his inbox and horror of horror- there was no report!"And going back through people's inboxes, this seems like it's been a problem for months- nobody seems to have received one for months.""Why are they just noticing now?" Branon asked."That's really not the problem here. Can you investigate why the emails aren't going out?"Branon put aside his concerns, and agreed to dig through and debug the problem. Given that it involved sending emails, Branon was ready to spend a long time trying to debug whatever was going wrong in the chain. Instead, finding the problem only took about two minutes, and most of that was spent getting coffee.
|
by Remy Porter on (#6K9CX)
Donald was cutting a swathe through a jungle of old Java code, when he found this:
|
by Remy Porter on (#6K8FN)
FreeBSDGuy sends us a VB .Net snippet, which layers on a series of mistakes:
|
by Lyle Seaman on (#6K6H5)
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.
|
by Remy Porter on (#6K5KM)
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.
|
by Remy Porter on (#6K4KM)
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.
|
by Remy Porter on (#6K41F)
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:
|
by Remy Porter on (#6K2RZ)
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.
|
by Lyle Seaman on (#6K0W6)
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.
|
by Remy Porter on (#6JZXH)
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?
|
by Remy Porter on (#6JYY1)
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.
|
by Remy Porter on (#6JXYR)
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.
|
by Remy Porter on (#6JX1M)
"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.
|
by Lyle Seaman on (#6JV80)
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."
|
by Remy Porter on (#6JTAH)
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.
|
by Remy Porter on (#6JSEJ)
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.
|
by Remy Porter on (#6JRJE)
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.
|
by Remy Porter on (#6JQTY)
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:
|
by Lyle Seaman on (#6JP3A)
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.
|