Book Review: Dependency Injection with AngularJS

 

Dependency Injection with AngularJS
Dependency Injection with AngularJS, by Alex Knol

Disclosure: I was provided with a free review e-book copy of this book by Packt Publishing. Which was nice. I am a big fan of AngularJS, and have been using it to build Zudio for a year and a half now. I’ve also read two of Packt’s other Angular books, Mastering Web Application Development with AngularJS and AngularJS Directives, which are both excellent.

TL;DR: 3 out of 5 stars

Well-written, accurate, plenty of AngularJS for beginners information, but not as much Dependency Injection as you might expect. Not a bad e-book purchase if you’re new to AngularJS, otherwise there are better options.

Review

This is a short book (63 pages in my PDF copy) which, according to its subtitle, aims to teach you to “Design, control, and manage your dependencies with AngularJS dependency injection.”

It starts off by introducing Angular in a fairly standard way in chapter 1. The next chapter introduces some concepts around clean code, the SOLID principles and Dependency Injection itself, then chapter 3 shows how DI works in AngularJS. Chapter 4 covers testing, and finally chapter 5 discusses management of large applications and code-bases.

The book is well-written and edited, clear and concise, and I found it easy to read and follow. The examples are mostly simple and get the point across, but this is not an in-depth or exhaustive tutorial. In the Testing chapter, in particular, the author covers a wide range of Angular testing practices, including Jasmine, Karma, and Protractor, but I would have liked to see more detail in the unit-testing pages, which is where Angular’s dependency injection facilities really shine. The examples given show the use of the inject function from Angular Mocks, and the use of a Scope and a Service stub to test a controller, but no mention is made of other Angular features designed to make testing easy, such as the mock-able $window and $timeout services provided in the core framework. The mention of Karma as a test runner is pertinent, but I question the inclusion of Protractor in the chapter since this is a top-level, end-to-end, integration testing tool, and so has no relevance to Dependency Injection.

In the end, my only real criticism of this book is its title (yes, I am judging it by its cover). It spends more time covering other aspects of AngularJS than it does on Dependency Injection, and it doesn’t go into that aspect to the level I was hoping for.

What it does do is provide a pretty good introduction to AngularJS, with reference to its Dependency Injection features, which are a major feature of the framework.

It’s also a little overpriced, at least for the print format.

If you’re considering using AngularJS, or in learning about its distinguishing features as part of your evaluation of JavaScript MV* frameworks, then getting this in e-book form is not a bad place to start. If you have been using AngularJS for any length of time, do not buy this book expecting detailed insights into the framework’s Dependency Injection features.

Trackbacks

  1. […] Book Review: Dependency Injection with AngularJS (Mark Rendle) […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 4,006 other followers

%d bloggers like this: