I’m quite new to AngularJS, having never really used it for much of anything and having barely made it through the tutorials. However, I find the general philosophy of it very interesting and what I do know about it sits very well with me. I definitely want to know more, so when I was offered a copy of AngularJS Services by PacktPub to review, I was happy to give it a read.
Starting off first with an explanation of just what services are and covering the basics of MVC and how services integrate into that architecture, the book immediately starts off with some good tips on best practices, which while not in-depth, give beginners like me with experience elsewhere a lot of useful pointers.
The book then rapidly goes into the design process of creating services, again bringing up several best practices which will serve you well in general, as well as specifically for developing service code. Again, this is all very useful even for beginners, despite the book stating earlier that it is aimed at a slightly more experienced developer.
I think I might prefer that the book either fully embrace catering to one or the other, than dedicate almost two chapters of fairly generic development best practices and little to no information about basic AngularJS knowledge itself, but I guess it would then either be a much larger ‘Learning AngularJS’ book, or a much smaller book that would be less useful for intermediate and fledgeling AngularJS developers that don’t have a lot of ‘best practice’ experience and knowledge yet.
In much the same vein as before, the next chapter deals with testing, giving a very brief overview of using Jasmine to do BDD-flavoured tests, which a few examples. It doesn’t go into any of the setup of Jasmine itself , but does give some useful, service-orientated examples of using Jasmine’s mocking capabilities to help make service tests less brittle.
The next four chapters actually cover a range of examples of writing service and using a number of AngularJS features to make highly flexible, decoupled code that can handle a number of tasks, from OAuth, to external CRUD data management, to Google API integrations and business logic tasks.
Throughout the book, the event messaging pub/sub model is heavily endorsed and used to great effect, the code and accompanying text explaining it’s benefits and how using it really makes the app a lot easier to maintain. Even if you cared nothing for AngularJS or services in it, the coverage and examples of using a pub/sub model to decouple and simplify application code here is excellent and makes the book worth it almost by itself.
While the book skims over the code fairly quickly, the code files for it are available so you can see everything in action.
All in all, it’s not a bad book. In all honesty, I think it split its focus too much and should have focused more of its efforts on covering the actual coding of services and more in-depth examples of building them over all of the best practice material because as it is, it feels a little lacking when it comes to learning about services in any real-depth, but doesn’t give nearly enough for an absolute beginner to really make any headway. That said, if you know AngularJS fairly well and only need a little nudge in the right direction to really help you ‘get’ angular services, then the book is a definite step up from the somewhat sparse official documentation on angular services.
So, would I recommend this book? I think the answer is yes if any of the following are true:
You know AngularJS but have no idea what services are or how to use them
You know AngularJS but want to level up your knowledge about best practices
You are an absolute AngularJS beginner that wants some reference material for when you get more advanced, but wants to pick up the basics of best-practice development early