Apps Script Library Design Pattern

142 views
Skip to first unread message

David Fernandez

unread,
Mar 14, 2024, 1:45:58 PM3/14/24
to Google Apps Script Community
Hi everyone, is there a best way to organize library code?
i've been creating script filtes with funcionalities and wanted to merge them in a library but i don't know if it is best to create objects as a way of making submodules, or directly creating libraries depending on libraries. 
The simple function and variable declarations for exposing functionalities seem too plain to organize lots of code. 
I've searched the web and couldn't find any clear guidance, also did an investigation analyzing varios libraries posted in github and none of the patterns seem 100% convincing to me.
Has anyone any thougths or best practices regarding this issue?

Thanks in advance for your help. 

Best,
David


Juan DIAZ SOTO

unread,
Mar 15, 2024, 9:37:51 AM3/15/24
to Google Apps Script Community

David Fernández

unread,
Mar 15, 2024, 10:04:06 AM3/15/24
to google-apps-sc...@googlegroups.com
Gracias Juan por la respuesta, mi pregunta está más asociada a los patrones de diseño en el código mismo y a la exposición de métodos y variables; que a la organización de carpetas y archivos. Gracias igualmente por tu sugerencia.

--
You received this message because you are subscribed to a topic in the Google Groups "Google Apps Script Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-apps-script-community/2DYmRb5C_Qg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/10960fd8-d2be-4f59-95b3-1c24587e00e8n%40googlegroups.com.

Bruce Mcpherson

unread,
Mar 15, 2024, 6:47:17 PM3/15/24
to google-apps-sc...@googlegroups.com
Hi David.
I have over 100  public apps script libraries
 I generally use this pattern.


You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/CAMLpCih7QEknNLYL0Y9A2hP7bDWnyk_OjgW3JGidFoa%3DgaZUew%40mail.gmail.com.

David Fernandez

unread,
Mar 15, 2024, 11:21:39 PM3/15/24
to Google Apps Script Community
Thank you Bruce!, as far as i've seen, your solution isthe best as it can get. I'll be implementing this way from now on. Thanks for sharing!
Have a nice day! 

Andrew Apell

unread,
Mar 16, 2024, 1:55:19 AM3/16/24
to Google Apps Script Community
Well, that is Bruce. His solutions always default to the best in any question he answers 😂

I recently released an API executable (similar to libraries), so I'm going to look at this resource and see if it can help me make it better.

Thanks Bruce!

Reply all
Reply to author
Forward
0 new messages