Tuesday, May 7, 2013

Reading about AngularJS - part 1

AngularJS, Google last breed MV* framework, is getting a really good momentum. Proof is this spring,  several books are coming out.

And, this is great news!

I remembered getting my hands on AngularJS for the first time, a couple of months ago. I started with the online documentation and with the mailing list. I also went a few time on IRC chanel, which is fun and the ultimate interactive approach :) One thing I particularly like is the usage of jsFiddle and  plunker for describing an issue in the mailing list or giving examples in the online documentation. What's better than thousand words? Code of course ;-)

Even though mailing list  and getting your hands into code is a great way to learn, I like getting my tablet in the evening and reading about the subjet. It gives a general understanding of the philosophy behing a framework, it also opens your mind by teasing you with paths to explore, different ways of doing stuff.... My blog post is actually not about AngularJS but more about AngularJS' books!

Available books

More recently, googling "angularjs books", to my pleasure gives me choices; at the time of writing this article:

- AngularJS - O'Reilly - Brad Green and Shyam Seshadri, completed book.
- Recipes with Angular.js - LeanPub - Frederik Dietz, RAW mode.
- Instant AngularJS Starter - Packt Publishing - Dan Menard, completed book.
- AngularJS Web Application Development - Packt Publishing - Pawel Kozlowski and Peter Bacon Darwin, RAW mode.
- AngularJS in Action - Manning - Brian Ford and Lukas Ruebbelke - to be available in Fall 2013,.

So I picked a couple of them, here is the ones I've read or I'm still reading for RAW mode ones:

AngularJS by Brad Green and Shyam Seshadri

One of the first book to be available on its completed form, written by 2 engineers from Googles Inc., I like the book, specially if you're completely new to AngularJS.

It's an 200 pages book with a nice step by steps approach. You should read it from start to end. With an amazing fast first chapter, giving you all the vocabulary to work with Angular, from templating, to data binding to dependency injection....

Chapter 2 get deeper and introduce AngularJS life cycle and how two-ways binding is achieved. In this chapter you've got AngularJS in a nutshell. I like the offline talk about unobtrusive JavaScript because that was exactly one of the point that bothers me when starting with the framework, I'm best practices addicted:)

Chapter 3 talks about the tooling which could have been interesting but to me it's the part of the book I like the least because it's going fast on Batarang, Yeoman, IDE and it's developing "Integrating AngularJS with RequireJS" which, to me, is not so much required.

Chapter 4, we're building GutHub application, all source code being in GitHub. Nope guys I didn't misspell, it's GutHub we're buiding  :)
Great intro to promises implementation in AngularJS with chapter 5 and directives look so simple to implement in chapter 6. Chapters 7 gives miscellious tips. Chapter 8 gives different sample apps, to be honest, I've skipped that one. 

Recipes with Angular.js by Frederik Dietz

As the title says it all: it's a recipe book, man. And indeed, if you look for a AngularJS concept you'll find a couple of examples about it. Source code is available in github which is great. Being published online, I wish we could have HTML links for code snippets, but fine enough once you've got github link all examples are ordered by recipe number. I like also clear proble/solution/discussion pattern. I wish it was a bit more verbose from time to time.

This book is not intended at giving an introduction on the framework. It's more a book you use by index.

At the time of writing the book is still on RAW mode with 100 pages. I expect more recipes to come. It's the diversity and broad coverage of recipes that makes the book rich and useful. Keep up with the good work Frederik.

AngularJS Web Application Development by Pawel Kozlowski and Peter Bacon Darwin

So far I've read only half of it. The book being still in RAW format, I've read chapter 8 before chapter 5. But I found the book quite promising. Once I've got the final version, I'll go over it again but in the right order, just for the pleasure :)

Chapter 1 is brillant, it gives you the philosophy behind the framework: declarative template view vs imperative controller logic paragraph is really worth reading. Crash course talking about 2-ways data binding, hierarchy of scopes: great! The discussing on Dependency Injection which gives a list of the different ways of achieving it with AngularJs is already advanced.

Chapter 2 is really about best practices in web application development and how they apply to AngularJS. Best part, being about Karma (still named Testacular in the book), this book just not speaks about test driven development,  it applies it! All book samples start showing the expected behaviour and then the code sample. To my surprise, the book sample angular-app is not following directory structure generated by Yeoman, with a bit of research I find the explanation in this thread on "by features" layout.

Chapter 3 is a bit off topic with CORS topic although nice to read but when it comes to promises, it is a real pleasure, it really goes deep in the explanation. Chapter goes on about $http and $resource services.

Chapter 5 makes routes and views clear to me which was one of the subject I was looking after. Delving into history API and HTML5 push state, you can understand how views can be routed using $routeProvider object so that you can achieve deep-link (navigable URLs) either using hashbang or HTML5 mode. To bing us to Angular routing service, the authors take a experimental approach coding a hand-crafted navigation bar using $location and ngInclude directive, and then later switch to $routeProvider and ngView. So you can truly understand the benefits of it. Paragraph on limitations of routes services is worth reading. It gives the starting point for the new AngularUI project ui-routes.

Chapter 8 on forms is full of details recipes directly available online. With this chapter you delve into details (such as validation) which gives the feeling to the reader: the book can also be used as “reference”. I like the details code snippets: you learn small tips and tricks. Very geek.

I'm still reading Chapter 9 and 10 about directives. This is the part where you teach your browser tricks. It's Angular way of taking the web from a different angle. Approach those chapters with a "read, play with it and read again" pattern.

As core comitters to AngularUI, I wish Pawel and Peter had written a full chapter on it. But maybe it's for a future project: write another book on AngularUI :-)

On conclusion, if you you want a book to have a general overview go for AngularJS from Brad Green and Shyam Seshadri. Interesting in "how to" style, google and use jsfiddle examples or go for Frederik Dietz's Recipes book. For a more deeper delve into AngularJS I would definitively go for AngularJS Web Application Development's book from Pawel Kozlowski and Peter Bacon Darwin. But...

For fall 2013, we'll have AngularJS in Action. I am looking forward to reading this one. this is the reason why I put in my article title: part 1. Stay tune for a "Reading about AngularJS - part 2" blog post!

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.