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!


I'm currently writing a book about how to build your first product. If you want to build your first product, please sign up to be notified when the book is available.

(By the way, I read every comment and often respond.)

Your comment, please?

Your Name
Your Url (optional)
Note: I may edit, reuse or delete your comment. Don't be mean.