After a while, writing code becomes less about knowing all of the specifics of a language, framework, or platform, but more about being able to match patterns. After seeing a sufficient number of different problems, you get better at saying, “Hey, this bit of problem X seems a lot like this part of problem Y, maybe we could use that.”
In this post, learn about the Delegation Pattern that describes an object whose role it is to accept requests, delegate those responses to other objects, then return the responses to the original caller.
Source: Delegating Client-Side Requests with google.script.run in Google Apps Script – Jeff Everhart