- 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
When I was new to Java, I made a handful of mistakes like this. The one that stands out is that I didn't know regular expressions were built into Java.
Admin
Admin
Admin
Admin
Reminds me of the time where I had to write something very closely resembling an XML-Parser, because the MS-Shrinkheads simply don't expose the stream position of found artifacts in their XmlReader class.
What my predecessor did with this particular problem would make a good WTF though, except that it's much too large to submit.
Admin
C# has a params keyword for variadic functions...
Admin
Admin
How do people keep confusing Java and C#? Don't things like string as a type, properties (such as emails.Length, list.Count), and upper-case method names seem like a clue? I mean, sure, they're a little more subtle than struct and delegate, but come on...
Admin
The **'s, they do nothing
Admin
Note that this code differs from Split in its treatment of consecutive delimiters.
Admin
There is a famous quote that applies here I think:
In my opinion, a good programmer distanciates himself from a bad programmer by knowing not a way to do something, but the best way to do something. Unfortunately that only comes over time, if at that. A most likely rookie WTF today :)
Admin
stoopit
Admin
I wonder how quickly could you code something to replace classes like WebClient or GZIPStream.
Admin
Surprisingly hard to parse email addresses. Take the following example for validating all possible permutations allowed by RFC 2822:
Admin
For quadrupeds, yes. I don't think the term applies to humans viz :
"That part of the spine which reaches from betwixt the shoulder blades to the loins. This name seems only applicable to quadrupeds, because they cannot reach it to scratch." From "The London Medical Dictionary"
Probably the sort of subtle mistake one would make coding one's own version of a standard library function.
Admin
String.Split has several overrides that take StringSplitOptions as an argument which alters the way it handles consecutive delimiters.
Admin
I'm pretty sure he's making the case that there are instances where using the description is faster, easier, and better than the simple word itself. Whether "split" is one of those instances was not part of his argument.
Honestly, for a bunch of people that occasionally call themselves programmers, there's a lot of closed minded attitude going around. And it's not just you and your post; I've noticed a disturbing trend the last few weeks of posts that take someones argument-via-analogy and interpret it literally, in an apparent attempt to counter that argument, instead of generalizing said analogy to understand other instances where it may be true.
Admin
Also - isn't email validation a fairly well known, overly solved problem? I hate it when people go OH BUT MAYBE HE DOESN'T KNOW ALL THE LIBRARY FUNCTIONS... yeah, but the most common ones should be easy to find. And even implemented correctly.
Admin
Admin
"Distanciates"? I like that. An instantiation of the act of distancing yourself, or something.
I'm goingtolunchiating now.
Admin
stbuttpid
Admin
Admin
String.split is more like one of the obscurer meanings of 'take'. If you've spent any time in the language, you should have a really good knowledge of java.io, java.lang, and java.util.
Admin
Gloves.
That is all.
Admin
Admin
Not that it makes any real difference, but the language in question is C#.
Admin
Suppose I wasn't aware of Java's Math.max function, and so instead of writing
bigger=Math.max(a,b);
I wrote
bigger=a>=b ? a : b;
Surely it would take me far longer to do the research to find the library function: We'd have to assume here that if I'm unaware of the function, I don't necessarily know that it's in the "Math" class or what it's called. Any competent programmer reading the code would surely understand it just as well as he would the function call. Better, perhaps, because maybe the reader doesn't know the function call and would have to look it up.
On the other hand, the first time I had to do DES and MD5 encryption, it was obvious that the research required to find library functions to do this would very likely be less than the research to find the rules so that I could write my own functions.
Seems to me it's like the classic manufacturing "make or buy" decision: how much work is it to build it myself versus how much work to find something already built by someone else and learn to use it.
By the way, I've seen plenty of cases where someone took the "obviously I should use the existing library routine rather than writing it myself" logic to the point that he writes more code to wrap around the library call than it would have taken him to just do what he needed to do.
Admin
By ignoring the language in the post (which has usually been altered to protect the guilty anyway), you can spin this as an indictment of any language you want to grumble about.
"This is typical of idiot C programmers who have never used a language that comes with decent libraries and string support."
"This is typical of idiot Perl developers who pride themselves on being able to do things more than one way."
Truth is, it's just typical of programmers under pressure to get something working.
Admin
Sweet, so I can add a method:
And change the semantics of existing method calls, including subclasses. Brillant!
Admin
I don't recall seeing string.split in K&R. . .
Admin
I have to poop...
Admin
if(!notDoneYet) { ... } if(notDoneYet == false) { ... } if(doneNow) { ... }
But I try to pick more descriptive names than that.
if(foundSomeMatches) { ... } else { ... }
if(doneSplittingStuff) { ... }
That way the code is legible and understandable without tons and tons of comments.
Admin
Come on now LightStyx, put some effort into it.
What you should have done is sit there clicking TDWTF endlessly until you can post a FIRST POST in my name, and then lambaste yourself for it.
Or you could insult OTHER users in my anonymous persona. Boy wouldn't that be fun! Ha ha!
'Cuz, you know, I have a lot invested in this anonymous, unregistered username.
Admin
Yes, but the same could happen anyway, so what's your point?
If you have a function:
Which someone calls as:
And you later add:
Then the call changes as well (after a recompile at least, already compiled code would still be bound to Foo(object)).
Admin
Admin
Make this a featured blue comment please! It's already a little bit blue, so we're halfway there...
Admin
If you change the semantics of a method out from under the feet of subclasses then yes, you can get some very odd errors. This is a well-known issue and the usual response is “if it is a problem, you've got a developer who needs introducing to the LART.” Don't Do That. (I've dropped libraries entirely when the developer pulled that sort of game on me without adequate warning. Life's too short for putting up with silliness without good reason.)
Admin
This is a simple string tokenizer, not some fancy API call! Splitting strings on characters is so old that COBOL has built-in routines for it.
The fact that the strings are e-mail addresses obfuscates the task. I bet the programmer has several string tokenizer procedures, rather than one re-used subroutine that he wrote.
It's possible to write your own code AND keep it small & organized.
Admin
Admin
This is typical of TDWTF posters. Not enough knowledge, too much ego. The language is clearly C# and not Java. Java does not have properties, String.Length is C#, the naming conventions are C#, List is an interface in Java, "string" is not a java type, "String" is.
Ok, now that we have that out of the way, knowing how libraries are implemented is very, very unimportant. Knowing their use is important, knowing their expense is slightly less important and not much else matters. Why should anyone spend time understanding the implementation of library functions when there is real productive work to be done?
Admin
Maybe it's just me, but I find the double negative in "notNotDoneYet" easier to parse than "notDoneYet == false", the latter requiring me to actually think about what it's supposed to mean. "!not" easily cancels itself out while reading, "not == false" doesn't IMHO.
Double negatives shouldn't not be avoided anyway, as you didn't omit to point out yourself.
Admin
I read somewhere that this is 'See Pound" and not yaba, so there is no library from where to find a book about it!
Captcha: luctus - A lactose derivative?
(See I've only been reading TDWTF for a few months and already learned the slangs... BTW First.... of the third page... or not!)
Admin
I always love to read the comments on TDWTF! (okay, the articles too...)
The first time I saw those entries containing "grammar Nazi", etc. it looked a little scary to me (as a German): "Uh oh - bad word detected - how can they write that... :-("
But it is indeed really funny to read stuff like "Fuhrer" knowing that the guys writing it don't have the "ü"-Key on their keyboards... :-) Looks just... strange...
Maybe you guys could use "ue" instead - "Fuehrer" would look a lot more authentic...
Admin
I just spent two weeks trying to do something which wound up being solved by one line of code, which I found on stack overflow. If your homegrown solution gets really really complicated, and the problem you're trying to solve ISN'T complicated. throw it out and google harder. Someone's already done it, more than likely. Aspire to egoless programming.
Admin
while(true == keepGoing) {...}
(Note 1: while(keepGoing) doesn't work if you have systems for which boolean 'true' and 'false' values are both nonzero, or if you care that you actually have 'true' and not some corrupt nonzero value. Yes, such systems exist and are more common than you'd think. And remember, 'corrupt' doesn't mean just 'bad memory', it can mean 'buffer overflow' or 'virus' as well.)
(Note 2: rvalues on the left of '==' is just a good idea, and once you get used to it, the strangeness goes away.)
(Note 3: Yes, I'm an embedded systems programmer. I wish desktop programmers had the same coding standards as embedded. Oh, and by 'embedded' I mean things whose main function is not computing but use computer control. So I'm not talking about your cell phone or portable media device.)
(Note 4: Yes, I'm opinionated and passionate about this particular subject field!)
Admin
Welcome to the Intarwebs. You realize you just meta grammar nazi'd somebody, right? Way to improve the stereotype. ;-P
Admin
FAIL! The correct answer is "You damn kids - get off my LAN!"
Captcha 'Feugiat' - when Feng Shui meets Italian auto design.
Admin
Thanks for making this work not thread safe (captcha: commoveo - is that laton for combover?)
Admin
Admin
If your compiler doesn't warn you about using assignment as an equality operator, then get a better compiler - or alternatively, use a language with native boolean type.
Your advice may or may not make sense for embedded programming (and I personally don't think it really does), but it definitely doesn't make sense for the programming that 99% of people are going to do. If that's representative of embeded programming standards, then the rest of us are very well off without them, thank you very much.