recommendations!
I've finally gotten around to linking to some of content and products that I think have been important to my learning. Hope the content's useful to you!
My personal developer library is stocked with pretty useful reference and learning guides. This page shares some of those titles, along with recommendations and reviews, with the hope that others can learn from it. I've been starting to use Shelfari (apparently Amazon bought them!) but haven't linked to it yet.
p.s. Jeff Atwood is convinced that developer books are irrelevant, so keep tuned to StackOverflow.com...
posts about books
LINQ really is hot stuff for .NET developers.
8/20 7:28PM Correction: The example OrderBy code below is incorrect. Updated and explained over here.
I’m late to the LINQ party. I thought I was good at keeping up with the latest trends and improving my skills. But I never embraced the importance of using LINQ versus learning about LINQ. I’m writing to say that I finally let its concepts marinate in my head, and it’s good stuff.
While making some improvements to .NET 2.0-era code, I went ahead and found some great places to use LINQ and lambda expressions to really simplify an implementation. I don’t believe in blanket updating, but rather updating when it’s clear, improves the maintainability, and you’re looking at low-impact, low-churn changes.
I’m about 10 years behind on this one I suppose, which makes sense: I still love watching The West Wing.
Here was the previous implementation in C#:
static void SortTestClasses(List<ITestClass> classes)
{
classes.Sort(delegate(ITestClass c1, ITestClass c2)
{
return Comparer<string>.Default.Compare(c1.Name, c2.Name);
});
}
And now, with LINQ, the static method itself really is hardly useful – it’s that simple:
Update: It’s not really quite this simple, see here.
static void SortTestClasses(IList<ITestClass> classes)
{
classes.OrderBy(a => a.Name);
}
Plus the addition of a Using statement for System.Linq.
This particular change was needed because I needed to update the signature of the method to take a generic IList, as opposed to a strongly typed generic List, which has a Sort method hanging off of it. But it sure does look better now.
There are a lot of good online and offline resources out there. I picked up a nice book on this last year.
- MSDN: 101 LINQ Samples
- MSDN: All about the LINQ project
- Mircea Trofin’s LINQ Framework Design Guidelines
- Pro LINQ by Joseph C. Rattz Jr.
- Coming later this year: Brad Abrams and Krzysztof Cwalina are finishing up the second edition of their awesome book on guidelines, updating it for .NET 3.5. The first edition really is a favorite of mine and often nearby, and it’ll be nice to get their thoughts on where to draw the line during API and framework designing.
At work we’ve been having some discussions about 3.5 language features, and although I don’t always agree with every single point, I will say that here are some of the things I’ve been doing and following as a result of this discussion:
- Updating private members with public properties to C# 3.0 automatic properties if you are already touching the file, and it’s a minor change
- Not using var in regular, non-LINQ code (“let’s not be too lazy”)
- Trying to limit the exposure of extension methods to users of frameworks, especially to common types
- No longer using #region’s to separate properties, methods, etc. – but rather only logical components or WPF goo when it makes sense
So to the one person who hasn’t figured out LINQ is cool, maybe this will help get you started.
Book Review: Pro C# 2008 and the .NET 3.5 Platform
Wow. This book rocks: Pro C# 2008 and the .NET 3.5 Platform, by Andrew Troelsen. I’d recommend it to anyone that wants to get a lot of meat on 3.5 and down to business. It’s a massive book and well worth making room for in your office collection. It’s hard cover.
When I picked up the book several months ago, my main intention was to get everything I needed to grok 3.5, after being focused on Silverlight for a while I realized that I wasn’t making full use of LINQ and other sexy features in my code. This reference did it for me, with MSDN as my backup for any of the nitty gritty topics like lambdas and expression trees. Today I’m still using the book often as a clear way to introduce others to the new platform.
A nice bonus was the ability to grab a PDF of the entire book from Apress for free after buying the book. I don’t know if this is a sign of the future or not, but being able to pull the book up in Adobe Acrobat has been almost as useful as being able to take the book to my favorite coffee shop to focus on the new 3.5 platform.
Don’t expect this book to tell you how to create a data structure, or what a ‘for’ loop is. The title is prefixed by Pro and it isn’t joking. This was enjoyable compared to many of today’s books that fill a few hundred pages with the obvious.
What surprised me, and many .NET developers will appreciate beyond the awesome C# 3.5 coverage: Details on so much of all things .NET – this is NOT a book for niche developers (web- only, client- only, looking to figure out XAML), but rather for enthusiasts, experts and technologists looking for breadth of knowledge. There’s some coverage of WPF. In-depth CLR stuff: assemblies, metadata, IL.
At the end of the day, C# 3.5 is great. Where I thought that generics were the bomb in 2.0, it is now obvious that C# has grown quite a bit since then.
Book organization
The Table of Contents can be downloaded online. The book is organized into these sections:
- Introducing C# and the .NET Platform
- Core C# Programming Constructs
- Advanced C# Programming Constructs
- Programming with .NET Assemblies
- Introducing the .NET Base Class Libraries
- Desktop User Interfaces
- Building Web Applications with ASP.NET
- Appendixes
You’ll also find the book’s summary, source, bonus chapters, and a sample chapter on the Philosophy of .NET (kind of like a quick boot camp for pros) on the Apress.com site for the book.
Note, there’s also now a VB edition of this book available. I’m not familiar with it, but since it’s also by Andrew Troelsen, I’ll assume that a lot of the material overlaps, especially on the full stack and platform coverage. Might be a good candidate to browse at a local bookseller.
Hope you find the book as helpful!
Book Review: Pro JavaScript Design Patterns by Harmes and Diaz
I recently completed a relatively quick read through Pro JavaScript Design Patterns by Ross Harmes and Dustin Diaz (ISDN-13 978-1590599082). It’s definitely one of those books that I’m happy to have read through; I’m always amazed by the flexibility of JavaScript as a language, and believe anyone not familiar with the intricacies of object-oriented JavaScript should pick this up. It also doesn’t dive into any AJAX or domain-specific coverage, making this feel a little less like a Web 2.0 book.
For everyone who appreciates the classic Gang of Four book, you’ll find helpful and interesting implementations of the basics, such as Observer, Adapter, and even Flyweight, in this book; a way to mimic interfaces for JavaScript, and the best rundown of encapsulation, inheritance, and OOP JS that I’ve seen in a book recently.
The application of the GOF patterns to JS is a sticky subject for many; with the speed that web sites and their software platform are revised, a more dynamic language like JS provides a chance to escape patterns for some. This book won’t help you solve that question, but it’ll give you good implementations and serve as ideal JavaScript code for anyone looking to spruce up their skills. Unlike a strongly typed language, part of the patterns implementation is going to be you communicating with your peers on how to actually go about consuming and publishing JS components in your product.
This also covers a lot of topics that aren’t stressed to JavaScript and AJAX developers on day one: methods being first class citizens, the importance of closures, and just how amazing JavaScript can be. I’d have to say that Chapter One, titled “Expressive JavaScript,” but each pattern-oriented chapter does a great job of covering the reasons for its need, multiple implementations, and an honest pro/con comparison.
Sour (stingy me?) point: as this was on my personal weekend reading list, value comes to mind: As with many of the shorter niche tech books these days, I find myself put off some by the $44.99 list price for just under 260 pages of content. By comparison, the very concise and in-depth Pro C# 2008 and the .NET #.5 Platform by Andrew Troelsen lists at a fair $59.99 for 1,370 pages of awesome content. Granted, both books can be had for less from any book discounter, and Apress offers an eBook format for $23.
Some of the books’ content from the publisher:
- Table of Contents [Apress.com]
- Chapter 1 – Expressive JavaScript [Apress.com]
Hope this helps!
Book Review: “Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries”
I recently picked up a copy of “Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries” by Krzysztof Cwalina and Brad Abrams. This is a great find; I’ve never picked up a hard cover book from the Microsoft .NET Development Series (Addison-Wesley Professional) that didn’t rock and belong in my library at home.
As I’ve been working recently on a new test framework library (while reusing a lot of existing components), the release of this book couldn’t have come at a better time. We all know there’s no silver bullet, and this book doesn’t try to pretend there is one-Krzysztof and Brad make it very clear that there still aren’t any perfect answers. A lot of decisions depend on your framework consumer.
The book is organized much like a Microsoft specification or guidelines document is; you’ll find helpful bullets designated all the way from “DO” to “CONSIDER” and “DO NOT,” among others.
Some of the key takeaways that I have:
- Keep it simple. Design with your customer in mind, and don’t get carried away with creating a framework worthy of a prize in perfection of theory
- Capitalization of your public methods is really important to creating a self-documenting framework that users are comfortable with immediately. I still cannot believe there’s so much contention in naming in the .NET platform even today.
- There’s no need to go virtual method happy with overloads; you often can provide your most specific overload the virtual designation
- Good reasoning and comments revolving around some classic situations: Array or Collection as a return type? String or Uri?
There are also some good resources near the back of the book, such as a starting point for your own coding conventions that take into account the implementation specifics and private code in your framework.
And I do have to point out one thing: The book format is truly unique for a reference that is 300+ pages. “Framework Design Guidelines” is effectively a massive bulleted manuscript, full of inline comments. I enjoyed this format, it really helped to bring home that these are suggestions, not solid rules; the arguments and points for- and against- were borderline fun, as were anecdotes about earlier .NET framework releases.
The reason I point out this unique format is that it is truly a Microsoft creation by two brilliant Microsofties: I can just imagine the Microsoft Word file that was used for collaborating between the annotators, and it is pretty fun seeing a book in print that roughly aligns with the “Final Showing Markup” reviewing mode of Word 2007.