When to use modules

I'm probably preaching to the choir here, but using modules has enabled me to develop very large-scale shiny apps in a logical way and still maintain some level of organization :+1:

One of the concepts that I highly recommend to dive in to is passing inputs/outputs from one module to another. It took a bit of practice for me to get the hang of it, and at the last rstudio::conf I showed @jcheng my adaptation of passing a large reactiveValues() object back and forth (heavily inspired by Vincent Nijs' radiant app). While it is doing what it is technically supposed to do, it certainly is more difficult to debug and I have the risk of not knowing which modules are manipulating which slots of those values. So I'd recommend you be very explicit about which objects you pass back and forth, and try to avoid just passing one huge object every time. In my next versions of these apps I'm going to do a much better job of documentation throughout the apps.

2 Likes