PDC09 Day 3
Keynote 2 today and wow! What a series of announcements, and what an excellent surprise with the giveaway of a touch screen tablet netbook to all the attendees (including yours truly)! Happy days!
So apart from the goodies and all the nice stuff happening around Windows hardware and the sheer variety of form factors, the big announcement was obviously around IE9 and especially Silverlight 4. I was expecting something about it but I certainly didn’t expect so much new stuff in there. The sheer volume of new features was amazing. I won’t go over them, instead I’ll just point you to Tim Heuer’s blog where he covers off all the new features. Go and read it, it’s very complete.
So, leaving that aside, I’ll run through today’s sessions:
ASP.NET MVC 2: Ninjas Still on Fire Black Belt Tips
This was a Scott Hanselman session and contained much of his usual silliness and humour (that’s a good thing by the way) but he also went through some of the cool stuff in MVC2.
The new ASP.NET tag <%: %> was shown which does automatic Html.Encoding calls on whatever the content is that you’re going to display. So instead of <%= Html.Encode(ViewData[“thing”]) %> you do <%: ViewData[“thing”] %>. Much better!
Next he showed how to customize the templates used for generating views when you select “new view” from Visual Studio. Since it’s all T4 templating it’s pretty easy to change – the trick is knowing where they are so you can copy them into the Code Templates folder in your MVC project and then remembering to clear the Custom Tool property in the properties.
Expanding on the use of T4 templates Scott also showed how to get strongly typed views in the code using the T4MVC template written by David Ebbo (@davidebbo). I’m not sure how I missed this, since it’s actually available for ASP.NET MVC 1.0 as well, but regardless this is great since it removes more of those dangerous magic strings from your code. The template basically generates classes for your content items and files so that instead of this
<img src="/Content/nerd.jpg" />
You can do
<img src="<%= Links.Content.nerd_jpg %>" />
Which is so much better since it’s all strongly typed and will get picked up at compile time. There’s a bit more in there so go and check it out.
Other things Scott showed that I won’t really go into, but that were also cool were the new data validation in MVC2 which gives you the option to turn server side validation into client side validation through the use of the <% Html.EnableClientValidation %> tag near the start of a page, and also the MVC Turbine project on CodePlex which gives you a more real world implementation of ASP.NET MVC using things such as the Unity IoC container, simpler route registration and the ability to write cleaner code.
Building Line Of Business Apps with Silverlight 4
This was a good run through of some of the newer Silverlight 4 features in the context of a business style application. It showed off some of the great Silverlight 4 features and was a pretty slick demo of how things like printing worked.
The only problem I had with the demo is the same problem I have with many Microsoft demo’s. They tend to skip things like talking about testing, deployment and keeping code maintainable. There was that much drag and drop going on that I was wondering a little what was actually happening under the hood and wondering what would happen in 6 months or so when changes needed to be made. But maybe that’s just me. Like I said, the session was good and it put a little more depth and reality to some of the things that had been announced that morning.
Is Open Source Old News (Birds of a Feather)
I’m relying enjoying connecting with people over here that I wouldn’t really get a chance to meet in Australia and this was a great chance to hear Miguel de Icaza (Gnome and Mono projects in case you aren’t aware of who he is) and others talking about open source.
Things got really interesting when Sara Ford talked about the CodePlex policy of cleaning out dead projects when they have had no activity for a certain period of time. This certainly sparked interest in a number of people including myself who didn’t believe projects should ever be removed. After all, it’s not up to the site maintainers to decide when a project loses value such that no one in the world will ever ever want to look at it again. It was also really interesting when Sara asked Miguel what it would take to get the Mono project hosted on CodePlex and the response was “Git support!'”. So help make it happen – go vote for git support on CodePlex (you know you want it anyway) and let’s see if it can happen.
Extending the Visual Studio 2010 Code Editor to Visualize Runtime Intelligence
I have somewhat of an interest in tweaking my tools and have played around with customising visual studio in the past with a number of still born add ins. I knew MEF was used in 2010 but hadn’t yet found the time to play with an see how it works.
This session was a chance to see that happen and I wasn’t disappointed. Even with the low energy and sedate pace the presenters went at the content was still compelling enough to keep me interested.
I got to see the basics adding things to the code window margins (like ReSharper does) as well as how to map a document out and visually locate and adjust things in the code window itself.
Extending Visual Studio is now reduced to a case of creating assemblies that export the appropriate interfaces via MEF so that Visual Studio can discover and load them, and call them at the appropriate times. So for the custom margin work I mentioned all you have to do is create a class that implements IWpfTextViewMarginProvider and then add a MEF Export attribute to the class for that interface along with some attributes to tell Visual Studio when to call this extension and when not to (e.g. edit mode vs. debug).
It’s very cool and I’m now thinking of a whole range of possible little helper things I could add to Visual Studio (that will no doubt all end up still born as well, but at least be a bit of fun to write).
So that’s it for today. I’ll be back tomorrow for a wrap up of the sessions I end up in as things draw to a close.