| Title: | C# Primer: A Practical Approach |
| Author: | Stanley B. Lippman |
| Published: | Addison Wesley Professional, 2001 |
| Pages: | 400 |
| Price: | $44.99 |
"So what is C#, anyway?" you may be asking, as we clear the smoke from two years of nearly unprecedented hype surrounding .NET. As you probably suspect, there really is a new language that you may actually want to use at some point. And though the early elegies for Java and C++ have proven erroneous, the truth is that almost any programmer could benefit from some basic knowledge of C#. Stanley Lippman’s C# Primer: A Practical Approach is a book for working programmers who want to add C# to their repertoire. The word "primer" is often a turn-off for experienced readers who already know what a loop is and don’t much care for long-winded discussions of trivial concepts. Lippman, however, succeeds in providing an introduction to C# without reinventing a whole introduction to programming. Consequently, this book may be just what you need to get up to speed.
Microsoft has stated at various times that C# is the preferred language for the .NET framework. This pronouncement invariably raises the question: "Preferred by whom?" As with any tip from Microsoft, one must begin by analyzing the marketing purpose of such a claim before evaluating the statement on technical grounds. But in any case, this book will help you sort out the question of when (and how) you might someday make use of C#. Lippman undoubtedly considers C# Primer a sort of sequel to his C++ Primer, which was first published in 1986. This parallel treatment may be alarming to those who resist the notion of C# as a sequel to C++. However, if anyone is in a position to describe C# from a C++ viewpoint, it is probably Lippman, who worked on .NET for Microsoft and has a long history with C++ dating back to Bell Labs and Stroustrup’s original C++ implementation. C# Primer actually borrows its format from Kernighan and Ritchie’s classic The C Programming Language. After a brief, two-paragraph introduction, the author launches into a simple program and methodically adds new layers of complexity over the course of the next several chapters. The "Hello, world" approach is, of course, standard fare for programming books, but it is worth noting that many of the books that attempt this format don’t actually get it right. An author must be very disciplined about adding only one element at a time and must resist the urge to embark on long asides. It helps also when the author is a good enough writer to succinctly illuminate the essential details. Lippman succeeds on all counts.
After a brief tour through basic C# components and concepts (such as inheritance, exceptions, and the all-important garbage collection), the author devotes an entire chapter to class design and follows up with a chapter on C# with object-oriented programming. The object-oriented chapter is a good example of Lippman’s approach: although he includes all the necessary definitions, he moves way too fast for a novice to learn object-oriented programming from scratch. The author’s unstated goal is, instead, to give a reader who already knows something about object-oriented programming the background to apply object-oriented principles in C#.
After mapping out the language, he adds a chapter on how to build a C# GUI with the Windows Forms Designer and another chapter on working with the ASP.NET Web Forms designer. Other chapters cover core .NET concepts such as the System namespace and the CLR (Common Language Runtime). As with the rest of the book, these latter chapters focus not on telling the reader everything but on organizing the information to maximize the instructional effect.
If you’re looking for a fat, desktop reference with every possible answer to every .NET question, you would probably do better with a different book. But if you’re a C++ programmer who wants to become a C# programmer without spending a lot of money or effort, try Lippman’s C# Primer.
Joe Casad is editor-in-chief of C/C++ Users Journal.