Use caution with anonymous types and other new C# language features

To subscribe to my feed, add the following Url:

I think Microsoft is making a huge mistake by leaning so heavily on anonymous types as API parameters, particularly in the ASP.NET MVC Framework.  Not only does this make the APIs in the system ugly and error-prone, but it’s not intuitive, and there is no intellisense for it because the API is untyped (typed as object) in the case where an anonymous type is expected.  I think we should stick with named types and named methods wherever possible.  I currently don’t see a problem with lamda’s if they give an advantage over regular arguments. I’m very cautious about automatically using new, unproven language features before we fully understand how they will affect the usability and maintainability of code.  Note:  we have NO track record for the maintainability of these new language features, and they were developed specifically for LINQ, so using them outside of that context is suspect, in my opinion.

I do have a conservative disposition on this, but this is through learning from the past.  I still remeber OpenXML is SQL Server 2000: how so many developers automatically converted stored procedure interfaces to be a single XML string rather than individual arguments.  We need to fully understand the long-term strengths and weaknesses of features in order to maximize the value of usage or non-usage.