Alex Papadimoulis

Founder, The Daily WTF

Mar 2007

The Longest Way to Zero

by in CodeSOD on

It was a pretty standard scenario: Lindsay F took over a small project from another department, and that project had a lot of “fun” surprises. Despite accomplishing a fairly simple task – reading in a fixed-width datafile, cleaning up a few things, and inserting it into a database – the application managed to be incredibly complex. Personaly, I blame the language they used: Java.

You’d think that the developers of Java would provide a simple way to convert a string, say "000000028000", into a number, say 280.00. At least Java does provide the System.out.println method. As the comments show, that proved to be an invauable tool in solving this almost impossible string-to-number conversion task ...


convertSingleQuoteAndDoubleQuoteAsciiToCharacters

by in CodeSOD on

Today's code snippet was discovered by Dave Conrad inside of a large production web application in its fourth year of life. As you might imagine, projects of such size are rather difficult to sum up in a brief article, but I believe that today’s Javascript function is a wonderful representation of said system.

convertSingleQuoteAndDoubleQuoteAsciiToCharacters is supposed to convert strings that have ' and " in them into ordinary strings containing single and double quotes. For instance, if you pass it "O'Malley", it will return "O'Malley". If you pass ")'Malley''s Irish Pub" it will … actually, never return.


Saving a Few Minutes

by in Feature Articles on

As we learned last week, G.R.G. has had a whole lot of experience in the IT industry. He’s even had the opportunity to work on a bona fide supercomputer. In fact, that’s where he got his start: he was one of twenty-five programmers that worked on one of the world’s most powerful computing machines. This supercomputer was capable of processing – brace yourselves, readers – several million instructions per second. Each and every second.

Of course, that kind of power did not come cheap. Not only did the supercomputer cost several million dollars, it required a round-the-clock staff of dozens to maintain and consumed enough electricity to power a small neighborhood. You might very well be wondering, what could anyone possibly need such incredible computing power for? The answer is simple: it was partitioned off and resold for $2 per CPU second. Or in today’s dollars, $10/second.


Sprite Threading

by in Feature Articles on

Sometime near the end of the previous millennium, Neinhalt Sieger accepted a programming at a small software company that built Java-based games. Although today we realize that Java wasn't quite the ideal platform for videogames, back in the 90's it was all the rage. If your game wasn't made in Java, it might as well have been with made out of wood and rolled with a stick.

Neinhalt was brought on specifically to work on a game called "Machine Man." The game's concept was completely original and nothing short of revolutionary: the player controlled a hero with a gigantic mouth that was trapped in surreal maze inhabited by four rather non-friendly ethereal types. The goal was to consume a vast amount of small, dot-like pills (the larger ones which made the hero able to consume the enemies as well) while avoiding the ghost-like ... err, ghosts. The only problem with Machine Man was the computers that wanted to run it. They were far to slow, leading to low frame rates, poor input responses, and skipping sound. And Bob, the lead developer of Machine Man, was no longer around to fix it.


Guest Article: Our Dirty Little Secret

by in Feature Articles on

Hi, I'm Jeff Atwood from Coding Horror.

Alex offered me the opportunity to write an article for The Daily WTF while he was away on vacation a few months ago. Unfortunately, the scheduling never quite worked out, and the tone of the resulting article was different enough from The Daily WTF format that it never quite fit in. But now that the site has been relaunched, it’s a perfect time to revisit the question that has nagged at me ever since I wrote the original article. What are we all doing here?


Emulating the 8080

by in Feature Articles on

Our good friend G.R.G. has shared some fun stories from his decades of working in the industry. Insecurity Doors, Mystery of the High Test Scores, and Twelve on a Line are among my favorites. Today, G.R.G. takes us back with a neat anecdote from the goold ol' days of the 8080 ...

Not too long ago, there was mainly just one operating system for 8080-based microcomputers: CP/M. It didn’t totally suck -- it could store files, load code into memory, run code in memory -- really, what more could one possibly need from an operating system? Well, when the 8086 CPU came out, it presented a small problem: CP/M (and all of the wonderful CP/M applications) could not run. Different CPU architectures, don't you know? In a brain flash, I thought: Why don't I create an 8080-emulator for the 8086! It could then boot to CP/M and run all of that wonderful CP/M software!


//TODO: Uncomment Later

by in Feature Articles on

What was your worst production failure?

Mine was a missing WHERE clause in a certain DELETE query that resulted in the deletion of all 6,000+ rows instead of just one. Whoops. Of course, my blunder only resulted in several hours of lost work, a painful data restore, and one really embarrassed junior developer (me). I'm sure, had I been in an environment like Adam's, I would have deferred to someone with more expertise or, at the very least, been much, much more careful.


We'll Optimize Later

by in Feature Articles on

The Rules of Optimization are simple. Rule 1: Don’t do it. Rule 2 (for experts only): Don’t do it yet.

These rules were coined by Michael A. Jackson (no, not that Michael Jackson; yes, that Jackson of the "Jackson Diagram") in his 1975 book, Principles of Program Design. It’s an interesting and depressing read that reminds us how much we knew about good software development then, and how little we follow that knowledge today. In fact, three decades and almost infinitely more computing power later, many programmers still fail to remember these rules on optimization. And among those that do remember, many have no idea what "optimization" means.


Announcement: Free Sticker Week Conclusion

by in Feature Articles on

Just wanted to give you all an update/conclusion on the Free WTF Stickers.

A total of 668 of you managed to get into the free sticker form between the hours minutes of 12:00P EST and 12:03P EST each day before the day’s 100 stickers were gone. And yes, I realize that 100 * 5 != 668; I coded the form to check the day’s count before loading , not after submitting. A bunch of you (337) also sent postage-paid requests through the mail and PayPal. Props to Michael V for mailing in a printout of a picture (taken on a wooden table, of course) of a screenshot of his word processor software with text asking for a sticker. Here’s a picture of that (taken, of course, on my wooden table):


Tool Blame

by in Feature Articles on

If you’ve worked in this industry long enough, you’ve probably gone down a road I like to call Tool Blame. I know I sure have. Tool Blame is that final, last-ditch act of desperation where one simply refuses to admin that he’s wrong and concedes to “working around” the “deficiencies” of the “pathetic” tool he chose to use in the first place. My absolute favorite example of Tool Blame is a tirade from a developer I once worked with: “what do you mean .NET can’t parse an empty string into a DateTime? My whole middle-tier is designed around strings! It’s going to take me at *least* a week to work around Microsoft’s bumbling incompetence!!!”

Though I might tell that story someday, today I’d like to expand on an article back from the WTF University series. For those unfamiliar, last year we all took a trip back to our favorite alma mater for a programming course, a security course, a web development course, and even a work-study on one of the college’s critical information systems. Enric Naval, the student who worked on that system, wrote back and gave an update on his experience and his trip down Tool Blame Lane.


Very, Very Well Documented

by in Feature Articles on

Just about all of the systems I’ve written about here share quite a few things in common: they are poorly designed, poorly coded, and even more poorly documented. Today, I’m happy to share with you a system that doesn’t quite fit in with all the rest. It’s actually very sound software and, most of all, it’s well documented. Very, very well documented.

George Nacht is a software engineer in certain a Post-Communist European country. In the mid-1990’s, his government decided that it was time to replace their foreign, Soviet-era fighter jets with modern, less expensive aircrafts of domestic design. And since they were modernizing their fleet, they decided to modernize their pilot training as well. This meant that new, interactive flight-simulator software needed to be developed.


The Complicator's Bicycle

by in Feature Articles on

Back in January, I posted The Complicator's Gloves, which was an example of what happens when Complicators get a chance to design something other than software. Recently, a reader pointed me to a fun article on the BBC about a software engineer who decided to “solve” the 150-year old “problem” of the bicycle. I couldn’t resist sharing it with all of you …


1: The back cog drives the back wheel chain, which unlike on a normal bike can turn either way when the back handlebar is steered.
2:Back handlebar which steers the back wheel and has a rear light.
3:Front handlebar which steers the front wheel and has a light and rear-view mirror.
4:Pedals are at right angles to the wheels.
5:The seat is shaped like an upside-down crescent.
6:This frame goes over the lap of the cyclist, but can go under if preferred.