SPA Design and Architecture - Understanding single-page web applications

Emmit A. Scott, Jr.

Published by
ISBN 9781617292439
RRP £30.99
Reviewed by Patrick Hill CEng MBCS CITP
Score 10 out of 10

A single-page application (SPA) is a style of browser-based application that differs from traditional web applications in that the entire user interface is provided by a single navigable page, rather than as a set of pages which are fetched, on demand, from the server. This approach enables browser-based applications to provide a user experience which is close to that of native applications.

This book covers a variety of topics related to the design and implementation of SPA’s and is structured into two distinct parts. The first part of the book consists of three chapters which provide the necessary background for the technically more substantial second part. Some prior knowledge of web applications and underlying technologies, such as HTTP, HTML, and JavaScript is assumed.

An introductory chapter describes the motivation behind SPA’s as well as their general structure, characteristics and advantages. Since an SPA provides a complete user interface, it is to be expected that layered design and implementation approaches, which separate presentation from data, should form a fundamental part of the discussion.

The author considers model view controller (MVC) and other related approaches, which are generalised as “MV*”, as well as outlining the MV* implementations of three popular JavaScript frameworks, namely AngularJS, backbone.js and knockout.js. The final chapter of the three chapter introductory section discusses the need for modularity in implementing SPA’s and describes a number of techniques that implement modules in JavaScript.

Having laid down the groundwork in section one, the second section of the book goes into detail regarding the design, implementation and testing of SPA’s. This includes a detailed discussion of techniques for navigating SPA’s through client-side routing, as well as communication both between components within the SPA and between the SPA and a server. The second section of the book concludes with a chapter on tools and techniques that may be used to unit test SPA’s.

This book contains a substantial amount of detailed information. Short illustrative working examples are used throughout and the source code for each chapter is available for download from the publisher’s web site. There is a great emphasis on practical learning and each chapter concludes with a “Chapter Challenge” that encourages the reader to explore the material further. There is also an appendix which gives a detailed explanation of a simple example implemented in each of the three frameworks.

One small observation is that with a book that is primarily focussed on JavaScript, it’s not clear why in the section on client/server communication the author chose to implement the server in Java rather than, for example, as a node.js application. Nonetheless, this is an engaging and highly readable book which should be of interest to anyone interested in modern web application development.

Further information: Manning

June 2016