Learning to cook with WP 7.5 data (a book review)
December 8, 2011 3 Comments
Recently I received a review copy of the “Windows Phone 7.5 Data Cookbook” by Ramesh Thalli from Packt Publishing (ISBN 978-1-84969-122-2). This book, divided in 8 chapters, shows how simple it is to write data-driven programs WP7 applications.
What follows is an extensive review of this book.
The basic premises of the book is the same as the other Packt ‘Cookbooks': each chapter consists of several step-by-step tutorials (dubbed “recipes”) , each time resulting in a mini-program with full functionality.
The main application that is rebuilt each time is a simple task manager. Each chapter 3 or more recipes are shown, usually (re)building the main task application. After each chapter and recipe a short explanation and reference to online sources is given .
The book is aimed at developers who have little to no WP7 experience, however a solid Silverlight understanding is a must (for any WP7 developer that is) to get the most from this book. The 8 chapters are logically ordered, each time increasing in complexity :
- Chapter 1 is a basic refresher on how data binding works in a Windows Phone 7 app.
- Chapter 2 describes how the local, isolated storage of the phone can be used to save data (to files) or settings. You can check out this chapter here.
- Chapter 3 explains how XML data (local and remote) can be parsed using both Linq-to-XML or an XmlReader. The final recipe than explains how object (de)serialization to/from XML can be accomplished.
The first 3 chapters explain topics of which an abundant amount of online tutorials exist. They didn’t really add much additional value for people already familiar with the basics of WP7. Though it should be pointed out that even the first recipes always did something ‘cool’ or new in addition to the core topic: most tutorials stop once the basic idea is explained. In chapter 2, for example, an image file is read and subsequently the image is then used as a background image for the app. It’s a small addition, but it lifts this (and other) recipe to a new, more usable, real-world example instead of a basic tutorial.
- Chapter 4 is where the fun stuff starts. Here, the Open Data or OData protocol is shown. The OData api of Netflix is used to show movie information on the phone; followed by a demonstration of CRUD operations with OData (using the OData.org api as example).
- In chapter 5 we meet the new goodie of the Mango phone, being On-device databases. Before Mango things like the Sterling NoSql OODB already existed. However, Mango now also provides out-of-the-box local databases which is, in my opinion, a nifty add-on. In this chapter 3 types of local databases are shown, namely: Sql Lite, Sql CE and McObject’s Perst (never heard of that one before and still not entirely sure why this one was added to the book). Again, this chapter goes further than most tutorials and also shows how to actually create a database using the SQL Management Studio and also import the db in the actual phone project.
- REST services are up in chapter 6. The first recipe shows the classic example of consuming an RSS feed, which basically is a repetition of the XML- chapter 2 with the addition of downloading the XmlString using the WebClient class . After that, the Twitter API is briefly shown and how it can be used to consume any twitter –data you wish. Finally , a simple rest service server is setup using ASP.NET’s WebMatrix , with the results being streamed in the JSON format and visualized on the phone.
- The second to last chapter 7 is titled WCF. The author quickly shows how to setup a WCF service, push some real (task) data to the phone and visualize it. Though these first 2 recipes are again pretty much ‘standard tutorial stuff’, the last one goes a step further and uses an actual SQL Server Express database as the services’ datasource. The ADO.NET Entity Framework (EF) is then used as ORM between the DB and the service (including Linq-to-entities) to provide a real-world example, which was pretty sweet to see.
- The final chapter (8) is the, meager, icing on the cake: in a few recipes the very basics of building an MVVM application is shown. I’m still looking for the ‘ultimate MVVM tutorial for beginners’ and I’m afraid this one isn’t a candidate (truth be told: I haven’t found any candidates so far except for Pete Browns chapter in his Silverlight 4 in Action book). Aside from not being very extensive, the basics are laid out very clearly including how to use Bugnion’s MVVM Light Toolkit. Unfortunately it would’ve been cool if the same ‘finale’ was given as in the previous chapter (i.e. retrieve the results from a WCF+EF service) as this was the final chapter.
Though the book covers a lot of stuff, it only counts a meager 207 pages: compared to Gill Cleeren’s Silverlight 4 Data Services Cookbook, the biggest ‘loss’ of pages is due to the lack of additional information being given. Basically each recipes can be followed but once you want to find out why this or that step actually works the book can’t help anymore. It’s also a shame that only the first few pages of code have the most important parts highlighted in bold fonts. By highlighting this code, it easy to quickly see in a big pile of XAML what the essential part is (even more once the boiler-plate code starts becoming repetitive). For some reason, the author stopped doing that after chapter 1.
To conclude; the concept of independent recipes makes it ideal to pick any chapter (or recipe) and start building stuff, without any dependencies on previous chapters or recipes. The downside however is that this also results in lots of identical steps that need to be taken each recipe. For me, this book is ideal in a classroom environment: students can be given a weekly recipe to solve and expand without the need of having made previous recipes.
If the idea of this cookbook is to whet one’s appetite of what can be done with the new 7.5 Mango Phone, it certainly succeeds . If on the other hand you expect in-depth explanation of one or more related topics, skip this one.
More information on this book can be found on the publisher’s site: here