|
YOUR FEEDBACK
|
TOP MICROSOFT .NET LINKS Product Review Book Review: "Microsoft .NET 2.0 Generics"
Everything you need to know about this powerful new feature
By: Dennis Hayes
Feb. 6, 2006 02:00 PM
.NET 2.0 Generics is my favorite book of 2005. Well, other than Harry Potter anyway. This book is not for new programmers. To understand this book, I would recommend that you have about a year of programming experience, and at least six months with C++, C#, or Java. This book is well written and is best used as an introduction to generics, so it is of most use to an advanced beginner. The reader should be familiar the syntax of a C-derived language such as C++, Java, or C# 1.x, and be familiar with object oriented-programming issues such as inheritance, overloading, and overriding. No knowledge of generics is needed to make use of this book.
The book starts off discussing the way collections in .NET 1.1 work by having members be objects, and how the need to cast types to and from objects clutters and complicates programs. It then shows how generics can clean up the clutter and make programs clearer and more flexible. It is also pointed out that the complexity of templates in C++ has to some extent given generics a bad name, and how generics, although not quite as powerful as templates, keep some of this complexity at bay. It then covers simple generic classes and follows up with chapters on generic methods and generic delegates. It also covers constraints, which allow only types with certain attributes or capabilities to be added to the collection. An example is a generic container that is meant to hold data table objects, and is given constraints that require any object added to it to have sort and update methods. The book also contains an advanced chapter on how generics can be created or analyzed using reflection, how they are serialized and deserialized, and how they work with remoting and Web services. For those who want to know what is happening "under the hood," this book has a chapter that gives details on how compilers and the run time implement and execute generics, and shows how the use of generics affects code speed and size. There are three chapters in this book from which I expect to get heavy use as a reference on a day-to-day basis. The first is a chapter on BCL generics, or the generic classes that come with the .NET Framework. Most of these are container classes, and this chapter covers how they work, including how to add, access, and remove items to each type of generic collection. The second chapter I expect to reference almost daily covers the "Power Collections" sponsored by Wintellect at www.Wintellect.com. There are several open source projects creating generic collections for .NET (as well as a lot of private companies doing the same). Of these, Power Collections is one of the larger and better known, and they also work closely with Microsoft (rumors are that the best and most popular of the Power Collection will be included in future versions of the .NET Framework). There is a long chapter at the end of the book that covers the Power Collections in the same way the earlier chapter covers the current .NET generics. The third chapter that will get continued use from me is a set of rules and principles to apply when creating your own generic classes. A key premise of this book is that generics are so powerful that you should not only use the ones provided by Microsoft and others, but you should also create new ones as a part of all of your applications, just as you do classes. The rules in the Generics guidelines chapter distill a lot of experience with generics and can help programmers avoid many of the most common mistakes. This is a must-have book for anyone using .NET 2.0. YOUR FEEDBACK
MICROSOFT .NET LATEST STORIES
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
|
SYS-CON FEATURED WHITEPAPERS MOST READ THIS WEEK BREAKING NEWS FROM THE WIRES
|
||||||||||||||||||||||||||||||||||||