• LCrawford (unregistered)

    Armando wrote some 'functed up' code! Something even Mary Poppins and the birds would enjoy - "Feed the birds, Tuple a bag. Tuple, Tuple, Tuple a bag..."

  • my name is missing (unregistered)

    Is a Tuple with four items a FourPle?

  • (nodebb)

    Three items - threesome, four items - foreplay. Also the class should've been called TupleManager.

  • P (unregistered)

    Actually Armando had not learnt about F#. What he learnt was C++.

    Because this is totally what people do with template metaprogramming in C++. You know, with all the std::tuples that is both rigid in shape, and type.

  • akozakie (unregistered) in reply to my name is missing

    IDK, but with five it's a Queen Tuple.

  • (nodebb)

    Oh, that's called "Functional"? I never knew that my colleague Johnny who always seemed to me a C programmer, is actually a functional programmer. He loves to write code like

        private readonly Dictionary<int, Tuple<int, int, int>> m_CanDataBitPositionsStart = new Dictionary<int, Tuple<int, int, int>>
            {SomeType.CAN_CANNON_ID_36, new Tuple<int, int, int>(SomeType.PDO_04, CanDataHelper.BYTE_IDX_0, CanDataHelper.BIT_IDX_0)}, ....
  • Brian (unregistered)

    My pet-peeve: misspellings in function names. Or is "flattern" some kind of newfangled way to mangle a simple conditional statement?

  • Little Bobby Tables (unregistered) in reply to Brian

    I hear you bruv.

    Mine own pet peeve is "An error has occured", especially when it can potentially arrive in front of the customer.

  • Anon (unregistered) in reply to Little Bobby Tables

    Better than displaying "Error -1" to the user, which what our legacy product does whenever anything goes wrong (and soooooo useful in tracking it down).

  • Chronomium (unregistered)

    To me, spelling functions wrong isn't just a peeve, it's a clear sign that whoever wrote the code is careless, and is probably causing other "not paying attention" problems elsewhere.

    Or doesn't have [local language] as a first language, but as far as I'm concerned that's no excuse. You chose to work in [foreign country], the onus is on you to pay extra attention to use [local language] correctly.

  • Purple (unregistered)

    Or you could do the sensible thing and submit all your code in English. Seriously, English is to us software devs what Latin is to doctors. There is simply no excuse to not use it exclusively.

  • Geoff (unregistered)

    Isnt the TWTF that Armando's code got past the code review?

  • koekum (unregistered) in reply to Brian

    That's just short for the flattening pattern, flattern

  • (nodebb) in reply to koekum

    The writer was just trying to flatter with his flattening.

  • Naomi (unregistered) in reply to BernieTheBernie

    The "functional" part is that functional languages emphasize recursion in their data structures as much as in their algorithms.

    If you want a more specific example, let's look at Haskell. For some type a, a List a is either the empty list [], or a pair of an a and a List a (which is actually just another way of describing a linked list - [] works like the null sentinel at the end of the list).

    Of course, Haskell's type system is actually set up to handle this properly, so the developer only needs to think about it when it's convenient. OTOH, the way "Armando" is using tuples is evocative of a functional language's recursive data structures, but without any of the things that make them worth using.

  • Perri Nelson (unregistered) in reply to Brian

    No, you misread that... It's "flatter n" :). The problem is you can't use white space in an identifier and they haven't heard of camel case, Pascal case, or snake case.

  • Herr Otto Flick (unregistered) in reply to Brian

    A flat Tern is what you get when you cross a seabird with a steam roller.

  • Little Bobby Tables (unregistered) in reply to Brian

    Maybe "flattern" is the Old English past tense of the verb "to flatter", as "spoken" is the OE past tense of "to speak" and "done" is the OE past tense of "to do"?

  • Deez (unregistered)

    Is his emulating a list with tuples?

  • (nodebb) in reply to Mr. TA

    "Long live the thrupple!"

    (I'll get me coat)

  • sizer99 (google) in reply to Brian

    In German, flattern is fluttering or wobbling, for instance: 'seine Lippen flattern, aber es kommt nichts Nützliches heraus' -> 'his lips are flapping but nothing useful is coming out'. (I apologize in advance to native speakers, I am not one). And it works, because this code is pretty wobbly.

    Also, I do 'functional' programming in C# where I can, because idempotency is wonderful for maintenance and not having ugly side effects. I just do it the sane way, with homogenous Lists and HashSets, which C# supports and encourages with LINQ. It's not Haskell, but it's not this nested <<<><><<>><>> vomit either. If you can't look at it and immediately know what it's doing, it's bad code.

  • (nodebb) in reply to emurphy

    You definitely went all the way to F# there. I hope I'm not the only one looking up "thrupple" and being pleasantly surprised.

  • Anon<Action<Expression<Func<A,B>>>>>>>> (unregistered)

    I hate to say it but this is mild compared to what I have seen in C# code. Once they discover how to manually build up an Expression<> objects so you can write generic meta methods to build up Linq queries, you are in deep shit. They will break, and there will be an urgent fix that depends on you untangling that meta-code or rewriting a large swath of the app. Good luck.

  • Simon (unregistered) in reply to Chronomium

    @Chronomium - agreed. Spelling errors don't always mean bad code, but they're certainly a strong warning sign that the developer isn't paying much attention to details.

  • capt bullshot (unregistered)

    Flatter-Tulpen? WTF? That's what I read on the first glance. Did make sense the same way the rest of the code did ;)

  • Bobcat (unregistered) in reply to akozakie

    . . . You are a horrible person and Christmas is ruined.

    Now if you will excuse me, I need to take my Sick Tuple to the vet.

  • NULLPTR (unregistered) in reply to Anon<Action<Expression<Func<A,B>>>>>>>>

    Syntax Error: Unexpected > at Line 1 col 36

  • (nodebb) in reply to Naomi

    SarcasmUndetectedError or SarcasmOverflowError?

  • (nodebb)

    works like the null sentinel at the end of the list

    Fun fact: The Null Sentinel is also the name of a cancelled Kiefer Sutherland movie sequel.

    Of course, Haskell's type system is actually set up to handle this properly, so the developer only needs to think about it when it's convenient.

    Most people solve this by not thinking about Haskell at all.

  • adk (unregistered)

    Flatter nTuple Result

  • Bulletmagnet (unregistered)

    It's tuples all the way down!

  • Naomi (unregistered) in reply to BernieTheBernie

    Neither! I just like talking about data structures.

Leave a comment on “Making a Nest”

Log In or post as a guest

Replying to comment #:

« Return to Article