Author: Scott J. Dorman
Publisher: Sams Publishing, 20102
Audience: Not complete beginners
Reviewer: Mike James
This is essentially an updated edition of a book by the same author on C# 2010, but a few things have happened to C# since then .
The new edition of this book doesn't really do justice to the new features and facilities in C# 5 and to the new frameworks it is expected to work with. However, this doesn't make the book useless because there is a great deal of core material that hasn't changed
The first thing to say is that this book claims not to be for complete beginners. You need to have some idea how to program before starting to learn C# in 24 hours.
Even so the book starts out slowly enough with an overview of the .NET system, and C# in particular. However, it fairly quickly ramps up the pace and quickly starts to read like a manual rather than an introductory text. The writing style is also suitable for the advanced reader. For example on page 16, i.e. very early in the book, we have:
Scope can be thought of as a container in which it is legal to refer to a variable with its unqualified name... A variable is guaranteed to be alive at least as long as the scope is executing.
Well I don't think about scope as something that is executing and a simpler and more user-friendly explanation of what scope is all about should be possible. I know what scope is and I had to read it more than once just to make sure I'd parse it correctly.
Equally you could ask if we really need to tackle the subject of scope as early as page 16? Yet straight after some fairly technical discussion we have a hand-holding step-by-step look at using Visual Studio complete with lots of screen dumps - is this supposed to be for the same reader?
The book then quickly forgets the slow pace of its screenshot-based introduction to VS and starts to ramp up the pace. In Hour 2 we look at Type, then classes, inheritance, enumerated types and structures and events.
This brings us to Part II of the book "Programming in C#" Why we need a new section is quite obvious as we go back to looking at some basics. In Hour 7 we meet program flow, then strings and regular expressions, arrays and collections, errors and exceptions, generic and finally LINQ. What binds this selection together is difficult to see, and why particular ideas are introduced when they are is also difficult to fathom. For example, why introduce strings, an easy and very vital topic, along with regular expressions which are difficult and could be left until they are needed? Why put arrays together with collections? And why end this section with LINQ when the next one is on working with data?
Part III is all about working with data but moves back down the level to first deal with files, then up to XML, and up to ADO .NET and LINQ.
Part IV is intended as an integration of all that has gone before and is about building applications. This consists of four hour-long lessons on building a Windows App (i.e. a traditional desktop app), binding and validation, building a Windows Store App (i.e. a WinRT app) and finally building a Web App.
Of course this brings us to what is new not so much in C# 5 but in what you are going to be using it for. WinRT apps have changed everything in the sense that now you not only have to choose between Windows Forms and WPF based applications but WinRT apps as well. The same sort of increased diversity is also now present in web apps. Once you only had ASP.NET now you have classic ASP.NET Web Forms and ASP.NET MVC. Of the two MVC is the way of the future but the book only gives an example of Web Forms.
The really disappointing part is the way that async, a major feature of C# 5. is described briefly in the hour on Windows Store Apps, with a brief note that async isn't just for Windows Store Apps but for apps in general. Well - yes this is true but async is the one big innovation in C# 5 and it changes the way that you approach any asynchronous task - it deserves more than this.
Finally Part V is called Diving Deeper and if you are anything like a beginner you will wonder how much deeper you can go. In this section we have some fairly advanced topics, attributes, dynamic types, garbage collection, threads,concurrency and PLINQ. As a realistic sign of the times the short overview of Siliverlight has been removed and Powershell and the Entity Framework are gone.
All these topics are dealt with at the most superficial level and with little real explanation or examples. You have to ask the question of why bother to introduce such advanced topics at such breakneck speeds?
Overall, it is difficult to see who this particular volume is aimed at. It has some good snippets of information and bits of advice that ring true, but basically it covers too much ground in too little space and even if you could get through it all in 24 hours you would be little better off than before you started. It is also clear that some of the new material has been tacked on without much attempt to take account of its effects overall - to put async just in the section on Windows Store Apps is the biggest problem.
If you are beginner then this is too advanced and too arbitrary in the order of presentation and level. If you know another language you might cope with some of the material, but again its arbitrary order that moves up and down the difficulty level is going to be confusing. Finally, if you are an expert then you presumably should know most of this stuff and at best it is going to be a refresher. It's simply too shallow a treatment to be useful in this case.
It's not a truly terrible book, but I can't see who exactly to recommend it to - unless of course you recognize your own particular set of requirements in the outline of the book. This revision hasn't helped make the book any better and it handles the new landscape of Windows development - ASP.NET MVC and WinRT apps - as afterthoughts.