Skip to main content

Key Learnings

Google AppsScript

This is my second foray into Google AppsScript. There's not much to learn about AppsScript itself, it's basically JavaScript. But there's plenty to learn about the Google APIs exposed in it. My previous effort is more or less scoped to GMail only -- this was my first time using different Google Services in an inter-dependent way. It was interesting seeing the trade-offs Google have made. They seem to be maintaining separation of concerns in ways that maybe are sacrificing the utility of the platform. Certainly there are things that intuitively seemed I should be able to do, that I could not do.

Compose and Decorator

I'm really fond of both of these patterns. I think they go along way towards making your code comprehensible, declarative, and self-documenting.

Functions, Arrow Functions, and Hoisting

I think I've just gotten so used to modules, I forgot you sometimes have to ensure you define things before you use them. It turns out, in AppsScript (and perhaps elsewhere), conventional functions (using the function keyword) are hoisted and can be invoked anywhere. Arrow functions are not.

Function Names

I didn't expect to find that function names are immutable. I had hoped to use the Function.name property in my logging decorators, but that only worked if the base function I wanted to invoke was directly below the logging decorator in the call stack. If anything intervened, the logging decorator no longer had access to Function.name for the base function.

In the end, I just supplied an explicit string to the logging decorator, which is a bit inelegant, but it works.