A fairly well-known idiom states that you can't teach an old dog new tricks—which is sometimes interpreted to mean that it's hard for older people to learn new things. However, as a 40-something developer I find that one of the things I still love the most about development is that I'm constantly able to learn new things or find better and more optimal ways to do things. To that end, I thought I'd share some mini-reviews of some great C# books I've read in the past few months.
My Need for Development Books
Although I spend most of my time as a SQL Server consultant, I can't help but love development—to the point where I occasionally do development projects for my clients, and I also have a couple of ongoing development projects of my own on the side. In fact, I'm frequently the embodiment of the joke among developers that says real developers take time off from work in order to code (I constantly find myself sneaking coding in here and there whenever possible). My degree is in Near Eastern Studies, which means that I don't have a formal background in development or IT. To that end, I find that I'm constantly reading up on various programming books or perusing other resources to try and improve my development skills, gain a better handle on best practices and techniques. and improve my overall code. Accordingly, I recently devoured a number of books on C# and found two that are definitely worth a mention for anyone else looking to improve his or her own skill set.
Pro C# 5.0 and the .NET 4.5 Framework by Andrew Troelsen (Apress, 2012)
Simply put, this is a great book. The author does a fantastic job of walking readers through the basics and fundamentals of using C# 5.0, making the process feel like you're sitting down with a skilled instructor who's moving you from one example to the next. By that, I mean the book is written well enough that much of what you learn feels like things you're discovering on your own—to the point where this book accomplishes one of those things that's very hard to do in teaching: staying one step ahead of learners and letting them discover things on their own. The best part of this book is that when you're done discovering various techniques and approaches to solving problems with C# and the .NET Framework, you've come to a clear understanding of how and why various best practices exist—because you've walked through the less than ideal solutions along the way as the author pointed out the weaknesses and failings of non–best practices implementations.
Another strength of this book is that it starts with the basics and moves to more advanced topics. Therefore, more advanced readers will find that they can easily skim through some of the earlier chapters and then slow down as they start approaching concepts and techniques they're not as familiar with.
If there's any complaint I could have about this book it's that it didn't, in my opinion, touch on some of the benefits and improvements afforded by C# 5.0's async and await syntax. To be clear, the author's treatment of multi-threading concerns and pitfalls is still excellent, but I think the one shortcoming of the book is that it could have spent just a few more sections on comparing async/await operations to other, less enviable, approaches to asynchronous development. (For additional info on async/await in C# 5.0, I found Alex Davies' Async in C# 5.0 to be a great read.)
Effective C# by Bill Wagner (Addison-Wesley, 2010)
I'm guessing that this book is an old standby for many C# developers. In fact, I might actually be one of the few remaining developers who hadn't read this book until now. Either way, this is a book that every C# developer should read.
The book itself takes the approach of tackling 50 specific ways to improve C# code. But more than being a simple cookbook or boring listing of problems and solutions, I found this book to be just as well written as Troelsen's approach to C# 5.0 and .NET 4.5. Wagner also does a fantastic job of leading readers through specific problems (with great and non-trivial code examples) that simultaneously make this book a pleasure to read and help readers come to the correct conclusions about some very important best practices that the author defines.
My favorite sections of this book related to some of the techniques defined to limit visibility of C# types. There's a whole section on this concept early on in the book that highlights why this is so important and how easy it is to think you've properly protected your private members—only to find that consumers of your code can easily bypass some of your best efforts. Then, subsequent sections (or tips) throughout the book also come back and touch on further concerns in this regard and provide additional safeguards and best practices. The reason I enjoyed this part of the book so much is because this is something I've personally been struggling with in some of my own code. Therefore, I found the author's advice to be not only helpful but also timely and topical.
My guess, though, is that if I skim this book again in another six to twelve months I'll find something else I like (and better understand) that much more. Or, stated differently, this book is a good enough reference I'm sure it can be read (or skimmed) over and over as a way to help developers make sure they're constantly honing their C# applications and code manageability.
I found both these books to be immensely helpful. I hope you enjoy them as much as I have.