• Mark Steward (unregistered)

    Very Adams-esque.

  • (cs) in reply to Mark Steward

    There are 3 types of developers, those who can count and those who can't.

     

  • woah! (unregistered)

    s|Pair|Crowd|g

     CAPTCHA: paste

  • (cs)

    plz tell me this is a joke.

  • Annon (unregistered)

    That was redundant...

    That was redundant...

  • snoofle (unregistered)

    Perfect! Now I know how to return results from:

       enum Boolean {
            TRUE,
            FALSE,
            FILE_NOT_FOUND
       };
    
  • Kreiger (unregistered)

    Oh, i get it! The WTF is that it isn't immutable. :)

  • rycamor (unregistered)

    I'm struggling to imagine just how this was used. Maciek, if you are here, please provide us some examples.

  • rycamor (unregistered)
    Derrick Pallas:

    On the plus side, he can claim that his pair is 50% bigger than mine.

    But of course, you can retort "But you don't really have a pair, do you?".
     

  • v. (unregistered)
    Derrick Pallas:

    ... me y me compadre: ...


    wtf?
  • NameNotFoundException (unregistered) in reply to v.

    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...

     

  • seer (unregistered) in reply to rycamor

    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)

  • seer (unregistered) in reply to NameNotFoundException
    Anonymous:

    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...

    A ternary pair tree? A tree-o-nulls? I love it! Actually, a proper pair-implementation could still provide the extra args

  • B for Bored (unregistered)

    Its obviously the threesome class' public name.

    Captcha stfu

    ...NO U 

  • (cs) in reply to rycamor
    Anonymous:
    Derrick Pallas:

    On the plus side, he can claim that his pair is 50% bigger than mine.

    But of course, you can retort "But you don't really have a pair, do you?".

    Even better, he has a

    • PairEx?
    • Trair?
    • Pair2?
    • Pair3?

    As for renaming them to reflect their usage and intention:

    • Pair_Company (two items)
    • Pair_Crowd (three items)
  • (cs)

    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.

  • MGS (unregistered)

    Maybe 'Pair' is the plural usage and it's just a data structure to hold up to three pair...
        getFirstPair()

        getSecondPair() 

        getThirdPair() 

    etc. 

     I could see that being useful.  Sort of.
     


     

  • (cs) in reply to IceFreak2000

    Well, I guess you could get a partriage in a pair three.

    Or perhaps this Au Pair is lookng for a Menage a Trios.

  • tea (unregistered) in reply to Kreiger

    Anonymous:
    Oh, i get it! The WTF is that it isn't immutable. :)

     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].

  • DanixDefcon5 (unregistered) in reply to tea

    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?

  • (cs) in reply to v.
    Anonymous:
    Derrick Pallas:

    ... me y me compadre: ...


    wtf?

    He probably heard "me y mi compadre" somewhere and, not knowing spanish, spelt it phoenetically.

  • (cs)

    It was coded by the producer of Car Talk.

     "Welcome back to the third half of Car Talk with us, Click and Clack ...."

     

  • WeatherGod (unregistered)

    So, who's on Second?

  • Dim Whit as int = 0 (unregistered) in reply to IceFreak2000

    They are used for storing objects in the viewstate

  • (cs) in reply to WeatherGod

    Anonymous:
    So, who's on Second?

    No, Who's on first.

  • tanisha (unregistered) in reply to IceFreak2000

    IceFreak2000:
    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.

     

    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
    of meetings, at various levels of the .NET project managements, to approve a modification to the right namespace or do it in System.Web.UI and get it over with.

     

  • aikii (unregistered)

    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 ;-)

  • [Si]dragon (unregistered)

    Why simply return a Collection instance when you can hard code a fixed number of fields into a badly named class!  Brilliant.

  • (cs)

    You really have to wonder what their class that only deals with two variables is called.

  • Calli Arcale (unregistered) in reply to DanixDefcon5
    Anonymous:

    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?

    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....
     

  • (cs)

    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.

  • MGS (unregistered) in reply to aikii

    Anonymous:
    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 ;-)

     

    Wow. That's, like, an obfuscated WTF!

     
    878470?
     

  • (cs) in reply to seer

    Anonymous:
    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)

    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.

  • (cs) in reply to [Si]dragon

    Anonymous:
    Why simply return a Collection instance when you can hard code a fixed number of fields into a badly named class!  Brilliant.

     

    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. 

  • Island Usurper (unregistered) in reply to jackass
    jackass:

    You really have to wonder what their class that only deals with two variables is called.

     

    I bet it's "Singleton". 

  • (cs) in reply to Island Usurper
    Anonymous:
    jackass:

    You really have to wonder what their class that only deals with two variables is called.

     

    I bet it's "Singleton". 

     

    In keeping with the genital theme, my money's on "Unit." 

  • Enteprisey Habkost (unregistered)

    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.

  • jkohen (unregistered) in reply to Whiskey Tango Foxtrot? Over.
    Whiskey Tango Foxtrot? Over.:
    Anonymous:
    Derrick Pallas:

    ... me y me compadre: ...


    wtf?

    He probably heard "me y mi compadre" somewhere and, not knowing spanish, spelt it phoenetically.


    You mean "yo y mi compadre," don't you? But that's unpolite, when enumerating people, you are supposed to name yourself last, as in: "mi compadre y yo".

     

    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?

  • MGS (unregistered) in reply to jkohen
    Anonymous:

    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? 

  • (cs) in reply to Kreiger
    Anonymous:
    Oh, i get it! The WTF is that it isn't immutable. :)

    Except, according to the OP, this class is inspired by the STL pair class, which is also mutable (according to glibc's headers, anyway).

  • A (unregistered)

    That must be for the parity information...

  • MGS (unregistered)

    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!

  • Rudolf (unregistered)

    Wow... if only all languages had Tuple's, that could save a lot of time :)

    p.s. captcha : quality

  • (cs) in reply to jkohen

    Ya'll caught me.

    • I don't know Spanish. (Pimsleur tried to teach me.)
    • I did learn phonics in grammar school. (An unfortunate experiment in the 80s.)
    • I am really self-centered. (Or not, but I needed to finish the pair.)

    In the future, I promise to think about asking a native speaker before I butcher foreign phrases. :)

     

  • (cs) in reply to Derrick Pallas

    It must be a "baker's pair."

  • seer (unregistered) in reply to MGS
    Anonymous:
    Anonymous:

    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? 

    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)    ;)

  • (cs)

    Perhaps, like me, they just find the word "tuple" to be vaguely pornographic.

    Kind of like "s'mores."  *eeeeeeuuuugh*

  • (cs) in reply to VGR

    VGR:

    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.

     

    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;

    public class Pair<T, E> {
        private T t;
        private E e;
       
        public Pair() {
            t = null;
            e = null;
        }
       
        public Pair(T t, E e) {
            this.t = t;
            this.e = e;
        }

        public final E getSecond() {
            return e;
        }

        public final void setFirst(E e) {
            this.e = e;
        }

        public final T getFirst() {
            return t;
        }

        public final void setSecond(T t) {
            this.t = t;
        }
       
        public String toString() {
            String s = "Pair(";
            s += t + ", " + e + ")";
            return s;
        }
    }

     

  • MGS (unregistered) in reply to Phalphalak
    Phalphalak:

    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.

    Uh... Any reason why you wouldn't use a HashMap for that? 

  • RangerNS (unregistered) in reply to MGS
    Anonymous:
    Anonymous:

    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? 

     

    Nope, it would have been just a "thumb"

Leave a comment on “Three's a Crowd”

Log In or post as a guest

Replying to comment #:

« Return to Article