JavaScript Application Design

Author: Nicolas Bevacqua
Publisher: Manning
Pages: 344 
ISBN: 9781617291951
Print: 1617291951
Audience: Intermediate JavaScript programmers
Rating: 4
Reviewer: Ian Elliot
 

Big JavaScript applications are possible and important and this book aims to give you the techniques and tools you need to do the job.

This is a book that assumes that you are fluent in JavaScript and it makes no attempt to explain the basics of the language. It is a collection of loosely connected ideas that you might want apply to control and manage your project. It is full of words like "build", "deploy", "dependency", and so on.

The first part of the book is about the build process and it is almost code-free. The argument is that even though JavaScript doesn't have a compile step there are still good reasons to use a build system - Grunt in this case. This might be true but why do the diagrams of the build process all have "compile" as a step. More importantly why are the example of things that you might do an a build process so few and limited? The argument is put forward that you can use a linter to check for syntax problems as a sort of substitute for a compiler - this seems like going  a little too far. Linters are really about keeping to a good style and to a certain extent you have to know enough to choose a style before you get into automating a linter step in the build. The first chapter seems to put off ever actually doing anything and tends to talk around the topic. It ends with a how to install Node.js tutorial.

Banner
 

Chapter 2 moves on to composing build tasks and flows. Again one of the steps is just labeled "compile" but it isn't easy to say what this means.  The first practical example of using Grunt is to run JSHint, a linter to discover style problems. Next we have an example of using LESS to make CSS more powerful, asset bundling, minificaton, sprites and so on. 

Next we move on to creating builds for different environments - this is where the whole build idea becomes more interesting even for JavaScript. After all you don't want to minify your development code but you do want to minify your production code. At the end of this chapter you have a rough idea how to go about creating enviroment specific builds. 

The final chapter in this section is on release, deployment and monitoring. This discusses how to use Grunt to automate the construction of your latest version of the project. The deployment example uses Heroku and there is a discussion of the problem of staging and production depolyment. This is a big area and it if full of problems which this discussion just starts to address. It is perhaps the biggest difference between building a web app and a traditional app and just to deal with Heroku doesn't really help enough. Deployment to one of the standard web servers would have been useful. The chapter closes with a look at the huge topic of monitoring. 

Overall the first part of the book might well be an eye opener if you have only worked on small projects or as a one-man team. You really only need this approach if the project, or the team, is big - although the author argues that even a one-man team would benefit. One of the problems is that the nature of the project being discussed is never made very clear. What is the difference between building a website and a JavaScript app? Are we building a mobile app? Of course there is a lot of overlap between the different types of application, but some discussion of the differences - the need to control the HTML as well as the CSS and the JavaScript for example. And finally where is Git, or any source control? 

 

JSAppDesign

 

In Part 2 of the book the huge topic of "Managing complexity" is tackled. Chapter 5 launches into a look at JS modules. Starting off with a general explanation of why modularity is important, we then have an exploration of how modules can be created using closure. There is a lot of code in this part of the book and in the main it isn't well explained. We have short and confusing explanations of this, scope, strict mode, hoisting and the use of the prototype. Any one of them could have been given more time and a logical order but what we have is a random collection of "difficult" parts of JavaScript. Next we have the CommonJS module explained and then a dive into dependency injection, Angular.js, require.js and Bower. Overall the chapter makes a lot of very easy things seem difficult.

Chapter 6 is about asynchronous methods and starts with an example of why callbacks are not the final answer. Some suggestions on how to manage callbacks is given and then a look at Async.js After this we have a fairly standard account of promises. No mention of the idea of async and await, even though we have a description of generators. The chapter ends with a look at events and how to create your own - good luck with understanding the example as it seems to have been included to impress. 

Chapter 7 is about MVC and Backbone.js in particular and Chapter 8 is about testing and both are fairly standard accounts. Chapter 9 is about REST API design and is perhaps the most interesting. It doesn't go deep into the REST philosophy and you are expected to find out what REST is all about on your own. It does have an interesting discussion of creating a logical API - you don't have to accept all of the advice offered - what is important is that you think about the design of the API and attempt to create something regular and meaningful.

The big problem with this book is that it tackles too large a subject. In places what it discusses is too general and in others it focuses on tiny aspects of using JavaScript. It also is a very dense and difficult read. The author tries to get you to see the need for this or that technique, but often doesn't provide a simple statement of what is going on. The code examples are particularly dense because you are never really sure what functions are supplied, what they do, or if might have to write them at some later stage. You are often left wondering what the code does and even if it is actually complete. 

If you are looking for a book that you can read to learn some of the ideas of managing a big project then you might find some parts of this book useful. Overall though it is more like a draft of a book that is yet to be completed. Perhaps this is a reflection of the current state of JavaScript development.

Banner
 


Graph Databases in Action (Manning)

Author:  Dave Bechberger and Josh Perryman
Publisher: Manning
Pages: 366
ISBN: 978-1617296376
Print: 1617296376
Audience: Developers interested in graph databases
Rating: 4.5
Reviewer: Kay Ewbank

This book sets out to give developers building applications using graph databases an understanding o [ ... ]



Deep Learning (No Starch Press)

Author: Andrew Glassner
Publisher: No Starch Press
Date: July 2021
Pages: 750
ISBN: 978-1718500723
Print: 1718500726
Kindle: ‎ B085BVWXNS
Audience: Developers interested in deep learning
Rating: Mike James
Reviewer: 5
A book on deep learning wtihout an equation in sight?


More Reviews

Last Updated ( Wednesday, 29 April 2015 )