AngularJS – Services

angular-services-bookAngularJS brings many useful features to JavaScript application development, such as unobtrusive data-binding and the ability to add functionality to HTML through directives but one of the often overlooked killer tools is the dependency injection framework. By decoupling the construction of code components from the components themselves developers are able to focus on the actual business functionality of their components.

At the core of AngularJS dependency injection is the concept of a service. Due to some unfortunate naming conventions and the ability to define services in a number of different ways, this concept is often confused and underused with Angular application developers pushing too much code into their controllers.  Services are a key element of structuring your application effectively – both for testability and maintainability.

In his new book, Angular Services, Jim Lavin guides the new and intermediate AngularJS developer through all the service related concepts and describes numerous good practices for defining, testing and using services in your Angular apps.

I like how the programming principles are laid out in general as well as showing how this is implemented in the Angular environment. Much of the book could apply to almost any dependency injection framework. I was also pleased to see so much focus on testing and testability. This is a key software engineering topic that has traditionally been overlooked in many JavaScript development projects.  Hopefully the reader will be inspired to work more testing into their own projects after finishing this book.

As with any set of guidance the reader should consider each piece of advice carefully as there is no such thing as a one-size-fits-all approach to software engineering. There is plenty in this book to think about and work into your own projects. Even the most advanced programmers are likely to find something useful in these pages.