Google Script

Author:James Ferreira
Publisher: O'Reilly
Pages: 216
ISBN: 978-1449318529
Audience: Intermediate JavaScript programmers
Rating: 3
Reviewer: Ian Elliot

Google Script is an important and very recent development in scripting of applications. Can this slim book deliver a coherent account?

Google Script is a server side implementation of JavaScript designed to act as a macro, or scripting, language not only for Google's spreadsheet but for the many end user apps that are provided by Google's cloud. It is a unifying language with a uniform framework and approach and this is one very good reason for learning it. If you know JavaScript then it is a really good way to add new functionality to a lot of different things.

The book is fairly thin but this needn't be a problem as the Google Script framework is very logical and structured, making it possible to be concise.




The first problem with this book is that it has quite a few typos - ranging from additional commas to variables that change name. This would cause a complete beginner a lot of trouble in following the examples, but to be honest a complete beginner is going to find this book difficult to use for other reasons. It makes no effort to teach JavaScript and so it is essential that you already know how to program to a fairly reasonable level.

While it would be unreasonable to expect the book to teach JavaScript from scratch, it does set the level of reader that the author expects as his audience. To a reasonably experienced JavaScript programmer there is much less to explain about Google Script. What the book needs to do is to cover is: what are the framework objects you can use; how do you create a UI; what are the limitations; and so on.




Unfortunately, the book isn't presented in a well ordered manner. This makes it very difficult to get an overall view of the framework and a feeling for how it all fits together. The first chapter is a basic intro, but it already starts to outline the three ways to create a UI - but without ever mentioning why you can't just use HTML.

Chapter 2 is about setting up you development environment and it is just too trivial. Chapter 3 gets back on to the topic of creating a UI, but again without much organizing theory. The final chapter of the section deals with actions which are obvious to any JavaScript programmer who knows what an event is. The focus is on using scripts in spreadsheets rather than on the entire range of possible apps. Even the focus on using spreadsheets isn't deep enough as it doesn't really answer the fundamental questions that every spreadsheet script writer needs answering - how do I get at the data in the spreadsheet and what are my options for doing so. Instead it provides a simple and overlong example at the end.

The second part of the book is called "Building Enterprise Applications". This starts off with the use of CSS, but actually it seems to be all about using a spreadsheet as a database. CSS doesn't get a look in until the very end of the chapter, where it is simply used to style a page. It doesn't tell you anything you shouldn't already know and if you don't already know it you aren't going to be much wiser for reading it. The ideas are thrown in as needed rather than explained in any logical way. For example at page 67 the JavaScript switch statement is introduced as a way of simplifying some code. Why single the switch statement out in this way? What is worse is that we have the line

"You may think that an "if then" loop is in order..."

Chapter 6 is about using forms and templates. Then Chapter 7 deals with collecting data using Fusion tables, which also contains the line:

"Honestly, I don't always know where a script is going until writing a few hundred lines of code, ..."

This wouldn't be so bad if the book wasn't subtitled: Enterprise Application Essentials.

Chapter 8 is on workflows and shows how to create an email workflow using Gmail. This is quite a good example of what you can do with scripts, but as no overall framework has been explained it still all looks like an ad-hoc exploration of what is possible. The same is true of the next chapter which details a project to use forms to direct emails. It's a nice example of what can be achieved, but my guess is that it would leave the beginner with a confused idea of how it all works.

The final part of the book is a set of UI examples which goes through each of the UI widgets in turn. Useful but something like it, only simpler, earlier in the book would have been more useful.

The biggest problem with this book is that it isn't suitable for the beginner and yet it treats its readers as if they were JavaScript programmers suffering frequent lapses in their knowledge. As a result it doesn't give you an overview of the framework or the sorts of things that you can do with it - it simply provides one or two examples. As to it being on the subject of Enterprise Applications, I hope that any enterprise class application is built with more attention to methodology than is suggested here. This reads more like casual scripting. In the right place there is nothing wrong with casual scripting, but this is not the way to build applications that lots of other people are going to use.

If you really are desperate for examples of using Google Script then you might get some inspiration from this book. Otherwise wait for a better one to come along.



Reliable Source: Lessons from a Life in Software Engineering

Author: James Bonang
Date: January 2022
Pages: 608
Kindle: B09QCBVJ9V
Audience: General interest
Rating: 5
Reviewer: Kay Ewbank

This book combines a fun read with interesting insights into how to write reliable programs.

Go Programming In Easy Steps

Author: Mike McGrath
Publisher: In Easy Steps
Date: January 2021
Pages: 192
ISBN: 978-1840789195
Print: 1840789190
Kindle: B08NF958NM
Audience: Non-programmers wanting to learn to code in Go
Rating: 5
Reviewer: Mike James
Getting going with Go - great idea!

More Reviews


Last Updated ( Tuesday, 13 November 2012 )