Tuesday, June 16, 2009

Perpetual Re-Education: LINQ, JQuery, EF and ASP.NET MVC

I recently reconnected with a developer friend and former colleague of mine who asked what new technology I'd been playing with. I promised him I'd send an e-mail with some good links and such. After writing up a quick e-mail summary for him I realized that the guts of it were probably blog-worthy (though not particularly durable given how fast things in evolve these days). Anyway, what follows is my e-mail to him. Let me know if I missed any obvious resources or must have reference materials.

LINQ:
LINQ is a huge part of .NET 3.0, not just some dime-store novelty. LINQ is Microsoft’s (IMHO excellent) attempt at adding a functional programming paradigm to the existing .NET languages. Of course LINQ is a huge topic so if there’s only one aspect of it that you examine in detail I would say that you *must* check out LINQ-to-XML. You’ll never want to do DOM/SAX again. I highly recommend the MSDN primer on this. It’s not as long as it seems and covers everything you need to know to dive in. On top of all that, I think LINQ-to-XML is a great illustration of the underlying concepts of LINQ (and functional programming) and will help you to get your head around LINQ as a general-purpose tool.

Of course there’s also the full LINQ-to-XML documentation on MSDN. (Though I think that MSDN docs are sometimes better as a reference than a tutorial/learning tool.)

For an excellent (and thin) tutorial-like approach to learning LINQ I highly recommend the O’Reilly book “LINQ Pocket Reference” by the Joeseph and Ben Albahari. You’re not going to find a more thoughtful, well-written and concise book on LINQ. It’s actually excerpted from their other O’Reilly book “C# 3.0 in a Nutshell” which is also excellent and refreshingly thin (without leaving glaring omissions or glossing over the important parts). So if you’re looking for a good general book on the full range of C# 3.0 features you can skip the “Pocket Reference” and just get the “Nutshell” book instead. As a huge added benefit, the authors have written an excellent (and free) utility called LINQPad that’s basically a cute little LINQ statement/expression work surface. Actually, it’s a full-on C# scripting environment/”snippet IDE” that you can use in all sorts of clever, non LINQ-specific ways. Google “linqpad” for ideas and examples on how people are using it. I can’t say enough good things about the Albahari brothers’ books and LINQPad. In fact, they have a paid version of LINQPad that adds auto-completion. I love the tool so much and find it so useful that I went and bough the upgrade to show my appreciation (though as an aside, the auto-complete feature is really nice, and well worth the $19).

JQuery:
Not much that I need to say here since I know that you share my JavaScript enmity and have already been looking at JQuery. I’m glad Microsoft is embracing the technology and baking it into everything since it appears we’re stuck with JavaScript for a long time to come in our increasingly AJAX-ified world (don’t get me wrong – I love rich, AJAX-enabled web apps, I just wish we could do it with something other than JavaScript). Anyway, my only recommendation here is the Manning "JQuery in Action" book. This is a solid, straightforward introduction to JQuery without a whole lot of fluff. It’s not a reference by any means (I don’t think that’s the intent with the “… in Action” books) but it will get you ramped up very quickly on the JQuery approach and does a great job of really explaining the fundamentals. I think they’ve now got an “early access” version of the 2nd edition of this.

ADO.NET Entity Framework:
I know you’re already up on this one but I thought I would just throw a couple things out there to look at. First off, I wouldn’t recommend the Manning “Entity Framework in Action” book. I know I just said glowing things about their JQuery book, and it’s only fair for me to point out that it’s still an “early access” (read “unedited draft”) version but even that doesn’t make up for the confused meanderings of the text. There are bits of good stuff in there, but it’s just not worth the price of the book. If my opinion changes substantially with subsequent updates I’ll let you know. [As a complete aside, I really do like the Manning Early Access program. It lets you buy inexpensive, pre-release PDF versions of their books and then get updates as material is added.]

If you haven’t already you should definitely check out Stefan Cruysberghs’ series of blog posts on the EF. He’s got a bunch of really interesting, sophisticated stuff in there that will get you thinking about how to use the EF including querying and extending metadata, LINQ-to-Entities and his .AsHeirarchy() extension method (along with some insights on using LINQPad).

Of course, there’s also Julie Lermans’ blog, though I’m sure you already know about that since you’ve got her book.

I highly recommend the EF Extensions library and corresponding blog by the author. There’s a bunch of really useful stuff in there and the code is rich with EF tricks.

Also, I don’t know if you saw this update on the ADO.NET team blog, but here’s a peek at some of what’s planned for the EF in .NET 4.0.

ASP.NET MVC
Last, but certainly not least, is ASP.NET MVC. This is a huge topic but well worth the time. If you’ve been doing WebForms development for a long time and/or haven’t ever trafficked in the MVC approach then this whole thing can be pretty mind-bending, and hard to even get started with. So instead of throwing a bunch of stuff at you and confusing you even more I’m going to make just one recommendation to get you started. Buy the Wrox book “Professional ASP.NET MVC 1.0” by Rob Conery, Scott Hanselman, Phil Haack and Scott Guthrie. These are *the* guys for all things ASP.NET at Microsoft and this is hands down the best (and briefest) book on the subject I’ve seen. They do a great job of covering a lot of ground in a small book without missing the important parts. Best of all the first chapter (which is really about 1/3 of the book) is a Scott Guthrie’s NerdDinner tutorial which walks you through the creation of a full ASP.NET MVC app from start to finish. This is probably the best way to get your head around the conceptual underpinnings of MVC *and* will give you plenty of good technical detail as well. I cannot overstate how good this book is (coming from someone who doesn’t buy that many technology books, despite what you might think from reading this e-mail).

Add to del.icio.usDiggIt!RedditStumble ThisAdd to Google BookmarksAdd to Yahoo MyWebAdd to Technorati FavesSlashdot it