Author: Andrew Stellman and Jennifer Greene
Audience: Novice C# developers
Reviewer: Mike James
A new edition but does it cover the new features in C# 5?
This is the third edition of Head First C#. There are 100 additional pages since the second edition, which in turn added 100 pages to the original, but not much has changed.
O’Reilly’s Head First series has a distinctive format – a cross between a notebook and a joke book – that you will love or hate. The mix combines conversational style, lots of graphics, copious annotations and quiz elements.
It all looks very exciting in a hyperactive sort of way.The one clear point is that you should only buy it if you are prepared to work through the book rather than read it – as is pointed out in the pre-amble the activities are not optional.
It is also arguable that learning to program is about logic and this isn't suitable for this sort of frenetic approach. In reviewing this book it is tempting to adopt the same over the top style.
As long as you like the book’s style, beginners will find it motivational. As author’s Andrew Stellman and Jennifer Greene point out the advent of C# 5.0 plus its availability in the free Visual Studio 2012 Express Edition make this a really good time to get to grips with C#. But wait I'm using Visual Studio 2013 - no worry just use the older version. Yes, this book was too late to use the cutting edge development IDE.
Another problem is that there is now Visual Studio for Windows 8 and a version for Desktop. It's a bit of a mess, which is not the book's fault. But if you do opt to use the latest version don't expect the screen dumps to match what you see. They also wont match if you don't use Windows 8 unless you download a PDF of the revised chapters.
The problem of the Windows 8/Desktop version of Visual Studio is more difficult. The Windows 8 version only creates Windows Store apps and the Desktop only lets you create traditional apps. Which do you pick? If you want to go with tradition and arguably the more useful skill you use the Desktop version but if you want to be trendy you use the Windows 8 version. This book uses both, possibly at the risk of confusing the complete beginner.
If you are interested in creating Windows store apps then you will be a bit disappointed because this only gets covered in a single new chapter. Most of the rest of the book is about desktop development, but this is perhaps the best way to learn the basic concepts.
Store apps are introduced in Chapter 10 and the other big new C# topic, async, is covered in Chapter 11. Otherwise the rest of the book follows the line of the previous edition (see my previous review) with some reordering plus two additional chapters - one on the MVVM model and one on building Windows Phone apps. Given that the book is supposed to be about learning C# I'm not convinced it is a good idea to broaden the scope to include these more advanced or specialised topics.
The book makes heavy use of the IDE to generate and work with code and this is good. It uses a simple game to get you started but the game is a WPF game using XAML and WPF. The choice of XAML makes sense if you want to later get the beginner onto creating Store apps but WPF complicates getting started for the beginner. There is also the issue that not many would choose WPF a the moment to start a new desktop project.
The activities are all similar in that they tend to mix the simple with the very complex and are only suitable if you are prepared to put a lot of work in and actually do them rather than just read. The three hands-on labs in the book are all games – and if you are pleased with your efforts you can show them off on the book’s own website, from where you can also download the games’ executables if you need extra help and support.
The book covers many advanced C# features such as LINQ for objects. In this case it is used in unconventional ways in the final lab – Space Invaders – to make collision detection easier not the usual way LINQ is used.
On the whole, however, this isn’t an advanced treatment trying to hide behind a facade of a simple minded presentation. This is a problem throughout the book where simple things are introduced alongside much more difficult and often abstract ideas.
For example, it gets into interfaces. inheritance and the subtleties of type before the reader really has had time to get to become comfortable with variables and the flow of control. On page 65 we have a discussion of the fact that two classes can be in the same namespace - why even raise the idea of namespace at this early stage? Yet on next page we are discussing variables and two pages further on loops are introduced with out very much preparation. These complex ideas are introduced as if they were obvious and all you needed was telling that they existed. If you are a complete beginner then you are likely to not follow. If you are not a complete beginner then why are you reading a book like this one?
If you get to the end of the book, which given it is more than 900 pages is quite a challenge, you are likely to want at least one more book about C#, but at that point you’ll be ready for something with a more staid and stolid, and abbreviated, approach.
There is much to be said for an abbreviated approach even for the complete beginner. In this book there is so much on every page that, to my eye it looks horrifyingly complex. its attempt to look "freeform" and hand annotated makes it look more like that scrawlings of a rocket scientist than a childish introduction to something easy. The addition of new technologies, such as Windows 8 store apps, MVVM and Windows Phone, makes it all even more complex. Much better to produce a shorter book targeting the core language, i.e. C# and the IDE, and not multiple frameworks.
Overall this is an over-complex approach to learning a language and it really doesn't have a clear idea of what order ideas should be introduced or what a beginner has difficulty with.
In this case the Head First format makes the situation worse by making even the simple look complex and chaotic. Of course if you love the hyperactive approach to learning then it might bew just the book you want. But it is still not as good as it could be.