- 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
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..."
Admin
Is a Tuple with four items a FourPle?
Admin
Three items - threesome, four items - foreplay. Also the class should've been called TupleManager.
Admin
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::tuple
s that is both rigid in shape, and type.Admin
IDK, but with five it's a Queen Tuple.
Admin
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
Admin
My pet-peeve: misspellings in function names. Or is "flattern" some kind of newfangled way to mangle a simple conditional statement?
Admin
I hear you bruv.
Mine own pet peeve is "An error has occured", especially when it can potentially arrive in front of the customer.
Admin
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).
Admin
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.
Admin
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.
Admin
Isnt the TWTF that Armando's code got past the code review?
Admin
That's just short for the flattening pattern, flattern
Admin
The writer was just trying to flatter with his flattening.
Admin
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
, aList a
is either the empty list[]
, or a pair of ana
and aList a
(which is actually just another way of describing a linked list -[]
works like thenull
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.
Admin
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.
Admin
A flat Tern is what you get when you cross a seabird with a steam roller.
Admin
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"?
Admin
Is his emulating a list with tuples?
Admin
"Long live the thrupple!"
(I'll get me coat)
Admin
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.
Admin
You definitely went all the way to F# there. I hope I'm not the only one looking up "thrupple" and being pleasantly surprised.
Admin
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.
Admin
@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.
Admin
Flatter-Tulpen? WTF? That's what I read on the first glance. Did make sense the same way the rest of the code did ;)
Admin
. . . 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.
Admin
Syntax Error: Unexpected > at Line 1 col 36
Admin
SarcasmUndetectedError or SarcasmOverflowError?
Admin
Fun fact: The Null Sentinel is also the name of a cancelled Kiefer Sutherland movie sequel.
Most people solve this by not thinking about Haskell at all.
Admin
Flatter nTuple Result
Admin
It's tuples all the way down!
Admin
Neither! I just like talking about data structures.