- 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
I find my car has a radio, cd player and air conditioning, so it's much slower.
Walking is a much simpler operation and much more efficient.
Can you help me walk at 70mph please?
Admin
Uughh. I think I just died and went to hell
Admin
...and the real WTF is that it still says: 1 comments.
It is true, one does, but I don't think that's how it's intended.
Admin
"Your brain has too many synapses. Mine just has three. It's more efficient."
Fail.
CAPTCHA: ewww (my first reaction to the vict-- I mean, featured employee)
Admin
O.M.G.
Even assuming that he HAD to write his own version of something that was already available, that is the worst implementation I've ever seen, including the stuff my students used to turn in!
Admin
For those amount of values in an array, you can use Duff's device.
But looking at some code and thinking it has too many functions, without understanding the code and know when it is loaded..... Yeah, WTF?
I don't know that library myself, but I do look into code to see if it is overkill or not. Default implementations do not simply mean fast. Sometimes you don't need the whole library.
Admin
I've seen similar things before, like a programmer with years of experience not knowing that there's anything faster than Bubble Sort.
I think this is a good counterexample to the people who say that CS degrees are pointless since most of the content is never used. Self-taught programmers can often have big gaps in their knowledge like this, since they've never had to learn boring stuff like data structures. And since it's an unknown unknown, they're not aware that they're missing anything.
Admin
How... did... my god.. I don't understand what these people do to be landed in these jobs.
Admin
Well, it's not even a hashtable, or even a map. It maps a key to multiple values, but the only way to access suceeding ones is to remove the previous ones... The guy obviously doesn't understand that array resizing involves creating a new array and copying the items (assumption about C#), and it looks like he didn't even look up what a hashtable is. ...I'm honestly surprised he could write working code with as little knowledge as this shows...
Admin
To paraphrase an old Saturday Night Live sketch: "It's not what you know. It's what you think you know!"
Captcha = "darwin" How appropriate!!!
Admin
I think James should get rid of at least one function. Three functions is not compact enough (five seconds).
Admin
That's the thing.
How can an idiot get a job when I can't? Who do they apply to?
But then, would I really want to work for the sort of person who'd happily employ an idiot alongside me?
Admin
Whoops, sorry, you can't ever access the succeeding values. Missed the loop in the remove code. ...So he knows there can be multiple values mapped to a single key... Forget it.
Admin
I dont see the problem. As it stands his implementation of hashtable is faster, although not because it has just 3 functions, but because there are far fewer layers of inheritance involved.
Admin
Something like:
/**
Admin
A HashTable with what, O(n^2) removal time? Briliant!
Admin
I wait with a sense of trepidation for the first ’This is not a WTF’ WTF comment
Admin
Admin
THUMP THUMP THUMP What's that you ask? It's my head landing on my desk.
Admin
It's called sarcasm.
Admin
Hey stop that! No dissing of Bubble sorting, without them we'd have to put some effort into optimizations when we need to show justification for a pay rise.
CAPTCHA: muhahaha - Yes, just what I was thinking...
Admin
Wait until you see his version of skiplist!
Admin
I don't know C#.. but one of the things that has troubled me in the past about "high" level languages(like Java) is that it requires an immense amount of knowledge to be able to do anything correctly while attracting novice programmers left and right.
Just normal C is easier to program in because you know what your C code is doing for the most part. Novice programmers should start there.
To write good Java code you have to not only know what your code is doing, but how everything your code is doing is implemented.
Perfect example of novices using a "high" level language when they don't know enough about coding is Gentoo's portage system. Python is the worst offender when it comes to luring in novices to do something they have no business doing.
Admin
I'm not saying you have to KNOW and USE hash tables to be a good programmer... but it sure seems that way.
Admin
It should be
/**
Admin
What's wrong with Portage?
Admin
Wow! This comment struck a nerve with me. I apologize if I go into a lengthy speech about this.
I have run into quite a few people that I graduated from College with who were MUCH better programmers than I was but none of them could find work, while I have had few problems finding development jobs from the day I got my diploma.
While I wouldn't classify myself as an "idiot", there is something to be said for having the ability to market yourself that can make you more "hirable" than someone with a broader skillset.
Now that I have had the opportunity to be involved in a few hiring decisions, I have seen one major trend in these highly-skilled newly graduated developers that make them undesirable. The biggest problem is ARROGANCE. No one wants to hire somebody into an entry-level position who thinks they already know everything. The personality of a new employee is just as important as their skill set.
I think every seasoned programmer has experienced a junior developer with some bizarre misconceptions about basic concepts (My personal favorite is "The only difference between inner joins and outer joins is that inner joins are faster").
The ones that turn into good developers are the ones that are open-minded and willing to learn.
Admin
Admin
But seriously, where's the WTF in this? Looks fine to me.
(Just implemented a very similar hash table in Ruby, pretty damn efficient over the 3 items in my test case.)
Admin
Check the python source for it :P I'll submit a few WTFs based on it next week when I get time.
Admin
he should use HashMap, Hashtable is slower because its synchronized :P
just messing with you
Admin
Wait, still to much
Actually.. why not just
Since an array of objects is just an object anyway?
Admin
Wow. Even as just a makeshift quick-and-dirty indexed table class this is real bad. I find myself among the ranks of those who fail to fathom how people like this find jobs and keep them for more than a week or two.
Admin
It's only faster at implementation time.
Admin
Did the article say James was self-taught? If we're going by anecdotal evidence, every WTF I've seen perpetrated by a current employee has been from a college-educated person. The best programmers in our department are self-taught.
Admin
I do not really agree on this mainly because C has the huuge overhead of learning memory management. C makes shooting yourself in the foot really easy.
Admin
God, I hope you're joking. This so-called "hash table" doesn't even use any, um, hashing.
Admin
If this wtf is real, than that is simply amazing! The guy sort of knows what a hashtable is and how it works, yet he thinks that fastness has to to with numberofmethodness.. As we say in my country (Norway): IDIOT!
Captcha: wigwam --> worst glam rock band ever http://youtube.com/watch?v=0XIyCKgA8z8
Admin
Easy improvements:
or even better,
Admin
At the end of the day.. your code is going to do things like access disk and memory which are resources that are more precious than cpu cycles on modern hardware.
I was reviewing some code for an unnamed company that was writing a server in Java for their game. They wanted to be able to update parts of the logic quickly and on the fly so they decided to use Jython which was fine and all but it was SLOW. The threads would call Jython and tell it to run a script with certain parameters. They even tried a test where they just did basic exec() calls on Jython that did nothing but return and the speed was the same so it wasn't the scripts causing the slow down.
To fix the speed problem I simply created worker threads that were implemented in Jython that looked into a queue to grab work to do. Even though it was much more complicated, had more threads, and had more code at the end, it was 1000x faster.
If you don't know how the classes involved are implemented, you won't know why the code went from running 1,000 scripts a second to 100,000 a second on my core 2 desktop. :P If all you knew was Java and knew nothing about how it and its classes worked you would swear the previous implementation would of been faster.
Admin
Better yet:
Passing stuff in and out is inefficient. Globals are the way to go. This should be a pattern.
Admin
Could you plz email me teh codes.
Admin
Always implement a bubble sort first. Then you can be the hero for really speeding things up in version 2.0
Admin
There isn't a language that has built in stupidity protection.
Admin
Admin
It's not a hash table, but I'll call it a hash table anyway. Then, when it's too slow, it must be because hash tables are too slow. Or something.
Admin
I don't see why hash-tables would have a lot of inheritance involved, its a basic container
On the other hand, custom implementation will not have built-in/platforms optimizations
As hash-tables is a structure used very, compilers often replace them with a very fast implementation
Admin
Better yet, screw functions:
{ }
Admin
Screw code!, machine code all the way baby...
Admin
Better yet, how about
int main(){ //...code goes here }
Anybody that's ever used JavaScript knows how costly function calls are, and every good technical manager knows that encapsulation just confuses new developers because then they have to look into the class to see what it's doing. Better to write everything in one function. That's why VBScript is better, because you don't have weird conventions like "int main()" - you can just write code in any old text file, put "<%@Page Language="VB"%>" (much easier to remember, and informative!) at the top and be done.
(Sadly, this was the state of the code at my workplace when I came on a few years ago.)