- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
That would be "Needs more animal worn noise device!"
Admin
I wonder if that's a variation of Clarke's first law. (http://en.wikipedia.org/wiki/Clarke's_three_laws)
"If a manager says we will never need a certain features, he's possibly wrong. If a manager says we well need this supposedly feature later, he's possibly wrong."
Admin
That form makes my eyes bleed.
Admin
And then, just to mess with mailshops everywhere, there's Ontario, CA.
Admin
Admin
Admin
EXACTLY! I tend to say: if you try to build the most perfect, most versatile and universal piece of software, you'll end up with a program that run-time compiles the configuration file. The configuration file will end up as a piece of source code, and will be just as difficult to maintain.
So: the most perfect piece of software ever written is the IDE.
Admin
Last one I worked on had a configuration file for the "product," a configuration file for the "market," a configuration file for the "client," a database table for the jobs to be run, a database table mapping the sub-tasks to the job ... all of which were in different formats, with different naming conventions and different parsers, and all of which had order-dependent side-effects on all of the others. Plus hard-coded defaults scattered around the code. Oh, and three different error logs in the database, plus two each in flat-file format for each job. That's what ten years of cruft does for ya. Probably Turing-complete, but it'd be a PhD project to prove it.
On a slightly different note, I think the discussion of generalisation is over-influenced, as so often these days, by the prevalence of Web applications. Ignoring laudable efforts with i18n and locales, gemeralising these tends by their nature to be simple code-twiddling, as with the wretched effort in the OP.
It's a myth that generalisation is intended to "avoid" making future changes to the code when functionality changes. Generalisation has little or nothing to do with code -- that would be refactoring. Generalisation, I suggest, is more appropriate at the design level (and few Web pages are "designed"); and the intention is to make everything as orthogonal and encapsulated as possible, thus allowing future changes to slide in without side-effects. Unlike with the abortion I mentioned above.
Admin
If you think that is bad, go to the main site.
I wish I'd worn the goggles; even though I've heard they do nothing, at very least they would have caught my melted eyeballs and prevented them from staining my shirt.
Admin
Both of these are broken. The point is that isAwesome() should never be called if s is null -- and I don't mean by having the calling code do the check. If the code can get this far with s being null, then the design is broken, or there is a bug. Either of the quoted solutions, does indeed hide this failure.
Admin
What a mess. NULL can't be un-awesome. Here is correct code, in case you don't get it
Event getting NullPointerException and tracking point where data was unexpected null (became invalid) is BETTER than masking this error, turning EXCEPTION into NORMAL behavior!
Admin
Admin
Did you invent a language for GUI programming? Wow!
Admin
http://cru.cahe.wsu.edu/CEPublications/eb1677/eb1677.html
Admin
Absolutely horrifying! For extra bonus points, check the company that hosts it.
I rebuilt this website from a flat HTML website, in the old days of ASP.NET 1.0 - it was a horrible job. I even designed a Windows GUI to change the contents and banners, and guess what: we never used it.
Admin
I think its a program for a undertaker.
Admin
Wow, squared is cool! I like squared!
Jiff www.privacy.es.tc
Admin
It was hardly a large chunk of code. It was simply a matter of replacing a 20 line piece of buggy code with a call of a thoroughly tested method doing the same thing except from the bugs.
And no, nobody scheduled a proper fix after the release, because there was at least five new features that had to be released every week. They weren't huge new features, but they did take time to get working because of more fundamental flaws, which there clearly wasn't time to work on fixing.
I have left the project. I would guess the project is still in the same shape as it was.
Admin
There's nothing wrong with the registration form itself, it's the text above it that was translated by Babelfish from the original AllYourBase.
The home page is Abomination and Must Be Destroyed.
Admin
Admin
The point is defense in depth - you don't want one error to blow up your whole codebase. Instead, it should act sensibly and reject null values.
Admin
Actually, there is a Podunk, MA, as well... but it is an unincorporated village within the town of East Brookfield.
And it's small enough not to show up on MapQuest.
Admin
Oh man this is just so wrong on so many levels. If brazzy is another TopCod3r, I'm suckered in completely.
It's not wasted until you go out of business. ...in which case it wasn't generic, but simply gave the appearance of being generic -- much like TFA. In which case you're not up to writing generic code. You mean change the expectations to fit the program? Wow.Admin
My name has been coming up a lot in the comments of this story. I haven't posted yet today because I have been busy trying to figure out if I have any money left after congress flushed it all down the toilet. I might have to pass a few more certification exams to get some additional bonuses.
Anyways, I don't really think the code for this is a WTF like many of you do. Once again it is taken out of context. If you are a front-end developer, you will probably not understand the reason why it is done like this, but think about whether you want to have code spread out into a bunch of event handlers, or whether you want it consolidated into a central location for maintenance purposes. The person who inherits the code later will thank you (I have personally received thanks before from people who have inherited my code).
The real WTF is why java makes you use equals(). That is just another example of how VB is better and VB programmers are more efficient...
If userField.Name = "From" Then Else if userField[i].Name = "SendTo" Then Else ...
or better yet, VB lets you do a Select/Case. I will leave that as an exercise up to you. Hint: If you learn how to use select/case it will greatly improve your coding style, but don't fall in love with it because it can have a severe performance penalty. But for junior developers, I suggest not worrying about performance right now, so don't worry about that yet.
[i]Addendum (2008-09-29 18:52): Edit: Thanks SomeCoder, for pointing out that I should have used () instead of []. I was trying to hammer out this comment, so I was lazy, but I certainly wouldn't want to mislead a new developer into thinking you could index into an array with [] in VB.
Admin
Isn't the generic Podunk in Illinois?
Admin
Admin
I haven't done VB(.NET) in a long ass time (for good reasons I might add) but aren't arrays indexed with the () operator rather than []?
feeds the trolls
:)
Admin
in after everyone who's never heard of "premature optimization", YAGNI, or Agile.
Admin
Admin
Thanks for catching that. I guess when you have been coding VB as long as I have you begin to overlook the minute details. One of the good things about VB is that the IDE takes care of all this for me, but since I was trying to make a point in the comment window, I did not check the syntax.
Admin
Unless it's valid for usedField[x] to be null. Every time I see someone make a stupid blanket statement like this, I thank FSM that they are not on my project team.
Admin
Admin
You're right. I agree 100%.
Often times I use null to indicate that the user chose the default value. So for example, for gender the default value is male, so I use null in the database to indicate male, and 1 for female. Same for states... the null value is Alabama, since it is first alphabetically and shows up first in the drop down list. So again, null indicates Alabama, 1 = Alaska, 2 = Arizona, etc. in both cases I use 0 (zero) to indicate that the question was left blank.
Admin
Is this one of those trolls, or do you actually do this?
Admin
TDWTF is so much more entertaining these days. Thanks, TopCod3r.
Admin
You, good sir, are a genius.
Admin
Sweet Home Null - Where Nulls Just Want To Have Fun!
Admin
Admin
Admin
assert(isAwesome(NULL) == NULL) ' Ternary Logic is valuable in this component
Admin
wow! this is the best wtf of the month, if not of the year.
there are two widely accepted ways to do it.
one is more theoretical and demands that you use null to indicate that the value is unknown. when null is used to indicate unknown, it becomes more obvious that you can't know if it's less or greater than some other value or if one unknown is equal to another unknown. that's why you have this weird null arithmetic.
design resulting from this approach allows all non-required properties to be nullable. code is usually pretty complicated because null values need special handling.
another approach is more practical. it says that if you have reasonable default value for the property and there is no explicit requirement to store "unknown" status, make your property not nullable and use your default instead of null.
in this design, most or all properties are non-nullable; code is usually simpler and has less bugs (but the memory of the property actually being unknown is lost).
Admin
Admin
Never underestimate the beauty of SQL code with "WHERE $column IS NOT NULL" in this type of design
Admin
Admin
There's no telling when someone will take it into their head to find a way to provide a null reference to a method, so deal with it appropriately. If being passed a null reference means the method can't perform any meaningful function then throw; but if the method can reasonably interpret the null reference and perform its function regardless then it should (just make sure you document the result when null is passed!).
I occassionally make the ability to pass null a feature: for instance, I have a method that returns a data table from a particular database given the name of the stored procedure and a collection of parameters. If the sp doesn't need paramaters, then what are my options? Reimplement the same method but without the parameter adding code? Make consumers of the code create and pass an empty collection object? Or let them pass null and deal with it appropriately?
Admin
Of course, TRWTF is that it takes the To address directly from the form, so what you have here is a generic spam gateway.
Admin
Amazing! Without knowing the specs for this particular codebase, you can just automatically detect that it's broken! I'm impressed with your abilities.
Not. It's possible that a null value OR "Awesome" are both allowable, but other values are not, for one thing. For another, any moron who can try and pronounce something as wrong without knowing anything about it is just that - a moron.
Try again soon. You'll actually find something correct to say someday....maybe.
Admin
Admin
Too specific, please genericize.
Admin