Anonymous Methods: Now that's a dumb name!
This has always bothered me and I've never quite put my finger on it until now. I love anonymous methods (in .net 2.0+). I've over used them, sure. I've under used them, too. And I've gotten all too excited about them. But the name is so very wrong. It puts the emphasis in all the wrong places. Anonymous, hey? Well what've they got to hide? Consider this chunk of code: Dim Result as Integer = Math.Sqrt(16)
What is '16' in the above snippet? Well, it's a value. And it gets passed to a parameter. Simple. But a different answer we could give -- if we wanted to bamboozle people right at the start -- would be: "Well in this case '16' is an anonymous variable."
A what? A huh? A... well.. you're just trying to sound clever aren't you? Calling it an 'anonymous variable' is only useful if you are the damn fool who's stuck with the job of writing a compiler for the underlying language. It doesn't help the regular johnny coders like you and me who code in the damn language every day. (unless the build is broken that day of course.) (or there are too many meetings that day.) (or the keyboards are wrong.) Similarly -- an 'anonymous method' is really just a 'code block', or an 'immediate method', or an 'inline method.' The point isn't that it is anonymous, the point is that it's a method. Maybe the term could be "throwaway method" -- as in, it's a method that's not designed for re-use. You just use it in this one place and then throw it away. Ah, rant complete.
Meanwhile my VS2008 beta has just expired, and my msdn subscription has just run out. I've got some serious vs2008 home-work to do in the next few days... so this is bad stuff. Bad i tell ya!
'god's dog' on Sat, 15 Mar 2008 11:58:18 GMT, sez: anonymous variable! very funny!
every line of code could also be called an anonymous statement.
regarding msdn subscription maybe u need 2 find a dodgy russian to help u out
'The Other Guy' on Sat, 15 Mar 2008 12:05:47 GMT, sez: Anonymous means "without name". What's wrong with that? Regular functions are chunks of code with a name. Anonymous functions are chunks of code without name. I don't see anything wrong in that denomination.
'jonah' on Sat, 15 Mar 2008 12:28:47 GMT, sez: Ah - good point.
Select queries in SQL could be said to return "Anonymous Tables"
@The Other Guy
>"Regular functions are chunks of
>code with a name"
Maybe regular functions should be called "Named Functions" and 'anonymous functions' just called 'functions'.
'Steve B.' on Sat, 15 Mar 2008 16:03:22 GMT, sez: The better term is likely something more like either "in-line method" or "temporary method" but sadly we are stuck with "anonymous methods" for good now.
Cat == out of bag, Genie == out of bottle, Pandora's box == opened :)
'MattyT' on Sat, 15 Mar 2008 22:49:01 GMT, sez: "Well in this case '16' is an anonymous variable."
I think of it as an integer of value 16. There's nothing anonymous about it in my (admittedly warped) brain.
And I don't really have a problem calling it an anonymous method. Consider what the fundamental difference is between these and regular methods. It's not that they are inline (regular methods can be too), immediate (they're not) or a code block (like all fns), it's that they have no defined name.
You can always call 'em lambdas... :)
Anyways, as always, thanks for making me think but I'm sticking with "anonymous methods"!
'Eber Irigoyen' on Sun, 16 Mar 2008 00:08:25 GMT, sez: kinda late in the game to be ranting about that, I agree with the other guy
'Anonymous means "without name". What's wrong with that?'
'lb' on Mon, 17 Mar 2008 00:03:19 GMT, sez: yeh alright -- i'll concede on this one. Anonymous methods *is* a good enough name.
Another possibility i've come up with is "ad-hoc methods"
'Waterbreath' on Mon, 17 Mar 2008 15:09:21 GMT, sez: How do you feel about "function expressions" or "function literals"?
Those are the terms that I typically use when I am explaining to someone what an "anonymous method" is. You can substitute "method" for "function" if you like, but I prefer "function".
'Ben' on Mon, 17 Mar 2008 16:18:20 GMT, sez: Ditto on "function literal" or "method literal".
You don't call character literals anything else do you?
|