Growing up, I always liked magic.  I actually spent a significant portion of my childhood earnings at a local magic shop in Milford, Ohio.  I remember vying for the really fancy tricks, but I always had to settle for the simpler, cheaper tricks.  I have always been excited to see magic performed and try to figure out how it might be done.  When The Illusionist came out on DVD, I watched and loved it.  Then I saw The Prestige, which blew The Illusionist away.  (If you haven't seen The Prestige, go add it to your Netflix list right now, it's fantastic!)  At some point today however, I realized that I don't like magic anymore.  I don't like it because it has bled into what I do everyday, which is writing code.

One of the skills that I was lacking when I came to Microsoft was working with LINQ.  Over the past week, I started using it and I have been lost.  Something just clicked for me though and I realized what I was missing.  I've been beating my head against a wall this afternoon, trying to understand how to create predicates to pass into methods.  The last thing I got stuck on was the fact that I was able to access .Where() in one context, but not another, and I didn't understand why.  Then it hit me, .Where() is an extension method!  In the class that had .Where() accessible to it, System.Linq was included in the using statements; in the other class, it wasn't.  I added the using statement, and now it works.

Extension methods are neat because you can add functionality onto virtually anything.  But they are not very discoverable.  Yes, I should have noticed that the tooltip said (extension).  Yes, I could have gone to definition on Where and found that it's defined in the System.Linq.Enumerable class.  But I didn't; I learned how to use Where the hard way.  Hopefully, now that's it's clicked for me, I will perpetually understand LINQ, but I got really frustrated while trying to get acclimated to the usage.

There have been a few other instances over the past couple of weeks, while learning new skills, that I've felt like the framework is working too much magic.  It seems like too many things "just work" without being able to connect the dots anymore.  Pardon me for being so procedural, but I like to be able to draw the line from start to finish, seeing a fluid connection between all components.  When it comes to an application framework, I don't like smoke and mirrors; I don't like magic.

Technorati Tags: ,