Tim Jeanes: Microsoft TechEd (Monday)
Hooray for TechEd! It's great to be back in Barcelona again this year, with its heady mix of sangria, pickpockets and syntactical highlighting in Javascript.
Last year the New Big Thing was .NET 3.0 and we saw how WPF, WCF and WF would change our lives. This year it's all about Visual Studio 2008 and .NET 3.5. As Visual Studio is basically where I spend all day every day, and as I've been writing code comments along the lines of "... and so we have to hack it like this. I can't wait for LINQ!" for the last twelve months, this really does have the potential to make my life a better place.
Enough smalltalk - here's the highlights of what makes VS2008 great:
At last! Javascript is handled properly! It gets syntactical highlighting and intellisense and (even though it's running client-side) it can be stepped through in the debugger. This last feature only works in IE right now, but Firefox support is just around the corner. The intellisense is a work of genius as javascript isn't stronly-typed. If you reuse the same variable to hold an integer and later a form element, the intellisense will track those changes and show the appropriate methods at each point in the code.
At last! CSS is handled properly! This is truly a thing of beauty - not only can you make changes in the designer and have these changes reflected either in inline styles, embedded style sheets or separate .css files, but a handy panel shows which of your styles are in effect on each element. And here's the clever bit: if your styles conflict with one another, you're shown which one overrides which. This could spell an end to my biggest frustration in CSS: applying a style to an element and then scratching my head wondering which style in which of my other five style sheets is blocking it.
Visual Studio 2008 supports multi-targetting. This means you can easily switch your solution between versions of the .NET framework: 2.0, 3.0 and 3.5 are supported. Even if you're coding against .NET 2.0 in VS2008, many new language features (automatic properties, implied types, object initialisers, etc.) are still available. This is because they're just clever compiler tricks that resolve down to existing code features at compile time.
MY greatest excitement, though, has to be reserved for LINQ. If you've been anywhere near .NET in the last year or so you're probably already pretty excited about it so I won't explain what it is from the ground up but rather highlight some of its nice features as I meet them over the course of the week.
An example of LINQ usage we saw today was this:
var myResults = from c in SomeCustomers
where c.City.StartsWith("M")
group by c.City into g
select new {City = g.Key, Count = g.Count};
This takes a set of customers and finds all those in a city beginning with M, then returns a count of how many customers are in each of those cities.
Of course this is something you could have done before, but if you consider for a moment how many lines of code that would take, and how that would look when you return to your code in six months' time, you can see this is a big improvement.
Note also that we haven't said much about what "SomeCustomer" is. It could be a List
Those two interfaces produce markedly different behaviour: In the case of LINQ To Objects (using IEnumerable<>), the compiler secretly codes up foreach loops for you and converts those "where" and "group by" clauses into regular .NET code. On the other hand, for LINQ To Datasets/ SQL/ Entities (using IQueryable<>), the compiler builds an object tree describing our query and passes it to whatever class implements the IQueryable<> interface.
However, as any coder knows, it's often the smallest feature you add that gets the biggest response from the user. The only new VS2008 feature that got a spontaneous round of applause was that when you click "Add New Item", the list of item types (class, web form, stylesheet, etc.) is now listed alphabetically. At last!
Seminars today: Keynote Speech (S. Somasegar et al); TLA201 (Daniel Moth); TLA318 (Luca Bolognese)
0 Comments:
Post a Comment
<< Home