| « Prev | Page 1 | Page 2 | Page 3 | Next » |
|
Very Adams-esque.
|
Re: [CodeSOD] Three's a Crowd
2007-01-02 10:15
•
by
Earl Purple
|
|
There are 3 types of developers, those who can count and those who can't.
|
|
s|Pair|Crowd|g CAPTCHA: paste |
|
plz tell me this is a joke.
|
|
That was redundant... That was redundant... |
|
Perfect! Now I know how to return results from: enum Boolean {
|
|
Oh, i get it! The WTF is that it isn't immutable. :)
|
|
I'm struggling to imagine just how this was used. Maciek, if you are here, please provide us some examples.
|
But of course, you can retort "But you don't really have a pair, do you?". |
wtf?
|
Re: [CodeSOD] Three's a Crowd
2007-01-02 10:57
•
by
NameNotFoundException
|
|
You guys have no clue. This is a very elegant and useful structure. Not only can you now return arbitrary objects (you can even return more than one null, for example), it even supports nesting! You can easily build trees from pairs (aka "prees"), and by adding just one little method: Pair getRest(), you can emulate a cool variation of functional-style list programming - in Java! This amazing invention is the mother of all data structures! Can't you see this? Ignorant fools...
|
|
Best guess is that it originally returned 2 items, then someone needed an additional item, and rather than rename it correctly, or perhaps change to some array of args to make it generic, they just added another field. Lazy good-for-nothing ... (it's too early in the year for this)
|
A ternary pair tree? A tree-o-nulls? I love it! Actually, a proper pair-implementation could still provide the extra args |
|
Its obviously the threesome class' public name. Captcha stfu ...NO U |
Even better, he has a
As for renaming them to reflect their usage and intention:
|
|
FWIW, the .NET framework provides this exact same object (albeit correctly named) as System.Web.UI.Triplet (alongside the equally useful System.Web.UI.Pair). Quite why they're buried in the System.Web.UI namespace is beyond me though.
|
|
Maybe 'Pair' is the plural usage and it's just a data structure to hold up to three pair... getSecondPair() getThirdPair() etc. I could see that being useful. Sort of.
|
|
Well, I guess you could get a partriage in a pair three. Or perhaps this Au Pair is lookng for a Menage a Trios. |
I almost sprayed tea all over my keyboard after reading that. I've learned my lesson - don't sip tea (or any liquid for that matter) while reading the daily WTF [captcha]. |
Re: [CodeSOD] Three's a Crowd
2007-01-02 12:21
•
by
DanixDefcon5
|
|
You know ... That sounds awfully like my college teacher asking us to arrange teams consisting in "pairs of three". Oh, and that was a Computer Science-related teacher... maybe he helped with this code? |
Re: [CodeSOD] Three's a Crowd
2007-01-02 12:24
•
by
Whiskey Tango Foxtrot? Over.
|
He probably heard "me y mi compadre" somewhere and, not knowing spanish, spelt it phoenetically. |
|
It was coded by the producer of Car Talk. "Welcome back to the third half of Car Talk with us, Click and Clack ...."
|
|
So, who's on Second?
|
Re: [CodeSOD] Three's a Crowd
2007-01-02 12:53
•
by
Dim Whit as int = 0
|
|
They are used for storing objects in the viewstate
|
No, Who's on first. |
Guess: The guy who needed the Triplet was in the Web.UI team and wasn't allowed to modify any other namesapces. Either he'd go through a series
|
|
I think all they wanted is some kind of predicate : object1, operator, object2 ( like ("jim" "owns" "doggie") , ("doggie" "is a" "dog"), ... ), so they describe problems and solve them in a prolog-like approach. Or like RDF statements. But then they came with an awfully confusing naming convention, the mother of all WTFs ;-)
|
|
Why simply return a Collection instance when you can hard code a fixed
number of fields into a badly named class! Brilliant. |
|
You really have to wonder what their class that only deals with two variables is called. |
Re: [CodeSOD] Three's a Crowd
2007-01-02 13:21
•
by
Calli Arcale
|
My high school gym teacher used to say "line up in pairs of three", but stopped long before I arrived in his class. My uncles had seen to that. Years before, they had repeatedly infuriated him by getting their buddies to line up in groups of six when he'd say that. He never did figure out (or admit to figuring out) why they were lining up in sixes, but at least he stopped saying "pairs of three". :p He was also fond of saying, "If it fits the shoe, wear it." Interesting guy, but not for any intended reasons.... |
|
As someone who has a looming problem like this in code he's now responsible for, I can say with near certainty that this was caused by plain old scope creep. The clear answer is instead of naming classes things like FooPair, just start with FooNTuple and let the future take its inevitable course.
|
Wow. That's, like, an obfuscated WTF! |
More generic is the opposite of what they should have done. I'd much rather have java.awt.Point and java.awt.Dimension than a single (theoretical) PairOfInts class. Writing small but meaningful struct-like classes for aggregate return values is trivial and the only reason not to do it is, as you said, laziness. |
Depending on the type of collection class used, you may need to dynamically resize (or "grow") the collection. The nice part about the code snippet is that, if the number of objects is fixed, you will never need to grow a pair. |
Re: [CodeSOD] Three's a Crowd
2007-01-02 13:48
•
by
Island Usurper
|
I bet it's "Singleton". |
Re: [CodeSOD] Three's a Crowd
2007-01-02 13:51
•
by
John Bigboote
|
In keeping with the genital theme, my money's on "Unit." |
|
That's not really Enterprisey. In our company, we've implemented a pair that is around 33.33% bigger than this one, and has double the size of standard, non-enterprisey pairs.
|
Back on topic, I've seen latex gloves coming in "pairs of three" so you had an extra one in case one broke in the middle of your dish washing. Maybe this was a glove factory stock system? |
So the third glove had the thumb in the middle? |
Except, according to the OP, this class is inspired by the STL pair class, which is also mutable (according to glibc's headers, anyway). |
|
That must be for the parity information...
|
|
WTF? Why is there a posting for a business development job in the Non-WTF job listings? Aren't these all supposed to be software development jobs? "Senior Director Development, Select Service Hotels" [CAPTCHA: wtf] Indeed! |
|
Wow... if only all languages had Tuple's, that could save a lot of time :) p.s. captcha : quality |
Re: [CodeSOD] Three's a Crowd
2007-01-02 14:42
•
by
Derrick Pallas
|
|
Ya'll caught me.
In the future, I promise to think about asking a native speaker before I butcher foreign phrases. :)
|
Re: [CodeSOD] Three's a Crowd
2007-01-02 14:46
•
by
John Hensley
|
|
It must be a "baker's pair."
|
No, it has a recursive pair of thumbs so it can go both ways (also useful for the multitudes with two thumbs on one hand) ;) |
|
Perhaps, like me, they just find the word "tuple" to be vaguely pornographic. Kind of like "s'mores." *eeeeeeuuuugh* |
Re: [CodeSOD] Three's a Crowd
2007-01-02 15:28
•
by
Phalphalak
|
I beg to differ. The existence of classes like awt.Point or Dimension are justified because they are entities which can (in a semantical sense) stand for themselves. A pair on the other hand is just a pair. Although you may represent a point by it, they are not the same. Thus, I don't think it has anything to do with laziness when avoiding classes for virtually everything. A helper class like a pair (or triple in that case?!) is quite useful. In fact I think you would be overdoing it if you would declare an own class every time you need to hold certain values which itself do not represent a notional entity. If I were to write a program with some sort of custom Point representation I would not of course keep handling pairs but I might define it with the help of such. I keep my own java library with useful methods and classes and pair has to proofen to be one of the most usefuls ones. For some geometric algorithms I required to temporarily associate Points with an index. I think it would be inappropriate to especially define a IndexedPoint class for that. Instead I simply used a Pair<Integer,Point>. I think that is a good example of when utilizing such classes makes sense. package util.misc;
|
Uh... Any reason why you wouldn't use a HashMap for that? |
Nope, it would have been just a "thumb" |
| « Prev | Page 1 | Page 2 | Page 3 | Next » |