Saturday, September 26, 2009

Reviewing Beginning Xml with C# 2008: From Novice to Professional

First off, I would like to thank Apress Books for their supporting local user group communities by donating copies of their titles for review!  

I would like to be upfront before jumping into the review: the first time I read the book, I did not like it.  There was not enough time spent with Xml best practices, not enough space dedicated to more Xml centric terminology and with a book weighing in at 600 pages, way too much information that is readily available via your favorite search engine.  So, I put the book down.

After a bit of reflection though I realized what should have been obvious: I was not the target market for this book.  While I am likely not familiar with some of the more esoteric features of Xml, I am very comfortable with the day to day application of Xml, and Xml related technologies, so I re-read Beginning Xml with C#: From Novice to Professional with a different perspective.


Xml can be a very wide topic just as ‘development’ can be a broad, as well as deep, topic. For sure, if you are a .NET developer today, you are virtually surrounded by Xml goo and its closing fast!  Xml might not always be in your face though, and its easy to ignore for a while.  It might be hiding behind some tooling, or buried in a configuration file, but its there nonetheless, just waiting to jump out of the shadows and club you over the head!  You can’t ignore Xml for forever, so don’t be a victim of xml, learn how to defend yourself today!


The Good

The author does a good job of uncovering all the nooks and crannies your likely to find Xml hiding: configuration files, serialization formats, Sql Server, and Windows Communication Foundation (WCF).

There was well presented information around when to use XmlDocument v. XmlReader which was nice.  XmlDocument is so easy that its simple to overlook the fact that if you really only need read-only access to the data, then XmlReader is your better choice.  I even find myself doing this on many occasions.

The chapter on using Xml with Sql Server was done well.

I was puzzled that DTD (document type definitions) received as much attention as they did.  However, there is a remote possibility you might run into them, so +1 for covering them.


The Bad

The author appears to make the assumption that Xml, without a namespace, is considered 'the norm'.  I say ‘appears’, as xml namespaces were pretty much ignored, and can’t be found in the index.  I'm reviewing to see if I just missed it, but working with Xml and Xml Namespaces are probably the first big hurdle a developer will run into.

I, unfortunately, am pretty militant around namespaces, believing if your not using namespaces, well then that's analogous to C# without a namespace, and only acceptable in the most trivial examples.  How many Employee schema's do you think are out there?  How do you tell your Employee schema from another companies Employee schema?  Heck, most companies will have multiple schema's for similar types across departments (Orders, Inventory, Shipment, Customer, etc..).  Namespaces are how you tell yours from someone else's and give you a pivotal piece of metadata to key off of in your versioning strategy.


The Ugly

My biggest complaints about the book, is also one mostly driven by yet another personal opinion, and that is the examples.  I’m not a fan of WinForm examples, unless your showing me an example that centers around WinForm development.  The best way to to show me Xml centric examples is with the good, old fashioned, console application.  Otherwise, there is too much technology mixing going on and key points might get lost in demo goo, not to mention consuming valuable page real estate that could be better used for more in-depth coverage of the topic. 



One might think that xml in the .NET world is ubiquitous enough that everyone who picks up Visual Studio will just learn through osmosis what they need to know about xml.  Some of this may even be true.  However, if you are new to developing for the .NET platform, having this book available could help jumpstart your development and keep you on task.