11 of 12 people found the following review helpful
on July 14, 2010
When Microsoft decided to step into the managed code arena in 2002, many people were skeptical. It seemed that Microsoft was addressing their inability to gain a foothold in the Java world by attempting to replace Java with their own version of a managed code language.
Over the next eight years, skepticism has died down as Microsoft has remained committed to supporting C#, managed code, and the .Net framework, and in the course of that support has released several versions of both the framework and the language, with each major release supporting exciting new features like generics, LINQ, and, in the .Net Framework Version 4, dynamic typing.
With each version, Christian Nagel and his coauthors have released a massive tome describing as many aspects of the framework and the language as they can fit in. The latest release, coming in at more than 1400 pages, is a comprehensive look at all the major aspects of C# and the .Net Framework, and many of the minor aspects as well. Wrox was kind enough to send me a copy of the book to review.
The book is divided into six parts. The first covers the basic aspects of C#, and the second covers Visual Studio. Then, the four remaining sections cover the majority of the .Net framework, the managed code assemblies that handle, for the Windows platform, almost any low-level task a developer would need to perform. The final four parts are: Part 3, fundamental objects; part 4, data access; part 5, GUI's; and part 6, communication. Experts will note immediately that the later sections cover both the "older" and "newer" styles of coding, e.g., part 5 discusses Windows Forms as well as Silverlight and Asp.Net MVC, while part 6 covers the Windows Communication Foundation.
Developers who want a quick overview of what's new in version 4.0 of the framework should probably look elsewhere. A couple of pages in the introduction cover the new features, but through the rest of the book, new features are not clearly denoted in any way. This book is definitely a reference to the entire framework, not a tutorial on using the C# 4 new features.
Chapter 1 is titled ".Net Architecture". It gives an overview of exactly what Microsoft is trying to accomplish with the framework, and goes into the mechanisms of translating a C# program into running code by means of the Common Language Runtime (CLR), Intermediate Language (IL), and the Just-In-Time Compiler (Jitter). Important features of IL that are commonly found in higher-level languages are covered, such as objects and interfaces, garbage collection, and exceptions. An overview of different types of programs that can be created with the .Net framework is given.
Chapter 2, then, starts the discussion of C#. Creating a "Hello, World" program is the initial demonstration, and the authors show how to do this using a text editor and a command-line compiler. Then the basics of creating programs are covered - loops, conditionals, and using statements. A list of every C# reserved keyword is given. Chapter 3 covers classes and structures, with constructors, member functions, and statics, and the base Object class that all other classes derive from. This leads directly into inheritance and interfaces in chapter 4, along with public, private, and internal modifiers,
Rolling along in C#, Chapter 5 covers generics, the ability to create methods and classes that work on any type of object. Two new C# features are introduced and explained: covariance and contravariance. Chapter 6 covers arrays, with some discussion of the building blocks that lead to the power of LINQ, including the IEnumerable interface, and the "foreach" and "yield" keywords. Chapter 7 covers operators, including the casting operators "is" and "as", nullable objects,and boxing, a bit of complexity for converting between value objects and reference objects. Quite a bit of attention is given to operator overloading and user-defined casts, not necessarily the most useful features of the language.
Chapter 8 begins coverage of some of the more functionally-oriented aspects of C#, such as delegates and lambda expressions, but chapters 9 and 10 return to fundamentals: strings, queues, bit vectors, and regular expressions. Chapter 11 finally introduces LINQ, and a new feature, Parallel LINQ, which provides developers with the ability to use multiple threads when processing a loop.
Chapter 12 is also on a new feature, the "dynamic" type. Dynamics are types that bypass standard compile-time checking, so you can call methods and set properties on them that are not defined in the type. The authors actually show the IL that is generated when you use a dynamic type.
Chapter 13 discusses memory management. In most cases, this topic does not come up as an issue as the C# garbage collector handles everything automatically. However, issues arise often enough that careful study of this chapter is a useful exercise for any developer with a serious interest in the .Net framework. The stack and heap are covered, along with finalizers and the IDisposable interface, and also techniques for direct access of memory (which is highly discouraged in just about all cases).
Chapter 14 covers reflection, the ability to examine the structure of an object at runtime, and chapter 15 is on exception handling. This concludes the basic discussion of C#.
Chapters 16 and 17 are on Visual Studio. A few of the different project type options are discussed, and a few of the options, but certainly Visual Studio is complex and powerful enough to deserve its own book, so only the very basics are covered here. Building an application, debugging, and configuration are discussed, along with deployment options.
Part 3 of the book is titled "Foundation", but it's really a mishmash of several topics of specialized interest. Most applications will require usage of one or more of these items at some point, so developers will need to know of their usage, but one could easily write a game of Tetris without reading any of these chapters. Topics covered include assemblies (global registration and versioning), logging (tracing and performance monitoring), security, localization, interacting with COM and native API's, and file and registry reading and writing.
One chapter is devoted to threads, which have had quite a bit of work done on them. The new Task library is covered, as well as parallel looping, and a new framework for cancelling long-running tasks. Also, Code Contracts are covered as part of the logging and diagnostics chapter.
A chapter on networking is included, and in 2010 every programmer should know how to request a file from the web in some language or other. This information is covered, along with techniques for embedding web pages into applications, and direct socket programming. These concepts are less globally useful, but the chapter on Windows Services is interesting.
Two chapters are devoted to rather unique aspects of the .Net framework: XAML, and MEF. XAML, an XML-based language that is generally used for display markup, has undergone quite a few enhancements for .Net 4, and this chapter is unusually clear in explaining which features are new to this version. MEF, the Managed Extensibility Framework, is a mechanism for writing application plugins.
Part 4 is about data. One chapter is devoted to ADO.Net, which can be comfortably skipped except by die-hards, because another chapter is devoted to the Entity Framework, Microsoft's entry into the object-relational mapping arena. Many developers may already be using another ORM such as NHibernate, but EF offers many nice abstractions over ADO.Net, so it is a more than plausible choice for an ORM. Other chapters cover XML manipulation, creating data webservices using the WCF framework, and coding in C# for SQL Server.
In part 5, all the building blocks come together to actually display things on the screen. While the choices for display really come down to either a standalone application or a browser, every technology Microsoft has developed for display is here. For developing a new application, the important things to know are: basic WPF and the XAML layout required to display things like textures and animations; data display and validation; Silverlight, Microsoft's strategy for displaying rich interactions in a browser; and Asp.Net MVC, basic HTTP request routing. These subjects are covered in chapters 35, 36, 38, and 42. The other chapters have some useful information, such as creating documents for screen display and printing, Ajax, and master pages, but for the most part they can be skipped over. They cover almost every technology that Microsoft has ever developed for presentation, and are really only presented for completeness.
Part 6 is on communication. A good overview of WCF is given, but this might be the only important chapter in the section. Other chapters cover Windows Workflow Foundation, which is an interesting technology but not one with proven value; some classes designed to work with P2P applications, RSS feeds, and message queuing.
Overall, this book has a spectacular amount of reference material. On top of the nearly 1500 pages of text and examples, there are several chapters available online for items the authors thought were important but didn't make it into the book. However, the authors have not made it simple to determine which topics are important or new, and which can be safely relegated to someday. It's easy to jump into the book and find yourself struggling to understand concepts like user-defined casting or ADO.Net, which many developers neither need nor want to understand. Yet, these are given equal billing with truly important and useful techniques like lambda expressions and the Entity Framework.
But there is no question that almost anything you would need or want to know about the .Net framework is in this book. It is a wonderful reference, and for any given topic, one can turn to the section and get a comprehensive overview of it. Given time, or a good teacher, a developer can become an expert in .Net from this book.