Programming C#, 4th Edition
by
tonyC
—
last modified
2006-11-05 02:15
review by Arien Malec, April 2005
![]() | ||
| ||
| Programming C# is a reasonably complete overview of the C# programming language, at least insofar as concerns the Microsoft C# ecosystem. It stays true to its target language, for all the good and bad that entails. Its target audience is the experienced programmer who needs to pick up the basics of the language quickly, but does not need a slow and gentle introduction to programming. That being said, Programming C# is not a concise book. It takes all of 324 pages to present the core of the language, without exploring much of the reasonably extensive .Net library. This makes the book somewhat slow slogging, particularly as the book makes no attempt to separate the important language feature from the rare case (if Programming C# were an algorithm, it would be a depth-first tree traversal). On the other hand, coverage is complete and accurate—no stone in the specification is left unturned. | ||
| I found some of the more useful corners of C# to be somewhat cursorily treated, however. Delegates (first class functions) are treated mainly as a tool to work with GUI event-driven applications, rather than a core, highly useful language feature. This is perhaps because other uses of delegates are considered somewhat obscure, even though one can create powerful code with first class functions (C# 2.0 makes this even more powerful by allowing anonymous definition of delegates, which previously had to be defined first as object members). Generics (another new feature of C# 2.0, which partially implement the parametric polymorphism of languages such as those in the ML family), are mainly treated from the point of view of the library consumer, using the collection classes, rather than the point of view of the library designer (although there are a few examples of creating new generic objects). | ||
The best programming language books satisfy three objectives:
| ||
| Programming C# satisfies the first objective rather well, but is much weaker on the second and third objectives. One does not get much of a sense of how to construct well-programmed and well-architected systems in C#. Most of the programming examples are throwaways (some with goofy references to Ayn Rand books), and are both useless as actual programs, and useless as examples of how to program. For instance, objects will contain calls to System.Console throughout, even when the programming example is ostensibly creating a general purpose object. The discussion of out parameter attributes uses an example that screams instead for a return of a utility object or stuct. Also, most of the examples have extraneous using directives for libraries that are not actually used in the example programs. These directives were presumably placed there by the IDE; it is sloppy style to leave them in the finished programs, as they assert something about the code that is not true. I would much prefer to see a complete useful example or set of examples to illustrate both the core language syntax, and how one program in C#, and emphasis on strong programming style throughout (even in toy programs, unless explicitly designed as experiments to probe odd corners of the language). | ||
| One odd aspect of Programming C# is the refusal to describe aspects of the language that are not part of the Microsoft toolchain. For instance, Mono is mentioned only once, and Windows is otherwise assumed as the underlying operating system. There is likewise no treatment of alternate IDEs, such as SharpDevelop. These omissions pale, however, to the lack of coverage for two tools that are, or should be, indispensable to the C# programmer: NUnit and NAnt. In particular, it strikes me as almost unprofessional to cover a language without covering the standard unit testing environment for that language. | ||
| ||
| The third part covers core library
functions, including reflection, threading, and I/O, which is
introduced starting on page 525(!). Why one has to wait until the end
of the book to learn how to read and write to the filesystem, console
or network is rather beyond me. As with everything else in the book
(with the exception of the second part), coverage is correct and
complete, but presented without much of an attempt to emphasize the
important. In general, Programming C# satisfies its goal of being a reasonably comprehensive introduction to C# for the experienced programmer. It would be, however, a much better book had it moved a bit faster, provided better examples of programming style, emphasized the key language features, and omitted the mostly useless GUI and web programming examples. | ||
