Hi, hope you guys are all good.
I was wondering what design approaches you guys have when developing large scale applications. Lets say you are going to design a web app with several pages, and you have a have a heavy OOP logic behind the app (i.e, you have a lot of objects/classes that you will need to interact with, etc.). Naturally, you divide your project in pages. Do you guys then separate the components of each page in files in a “components” folder? And regarding with the heavy OOP based-interaction, you just keep serializing the objects in each page app?
This probably sounds a little too broad - but I was just wondering. Since Dash is a reactive framework, you mainly see projects treating input data as is, sharing them in callbacks and not necessarily taking OOP design approaches, etc. Sorry if this is dumb or anything.
Hey @jkpeq! Welcome to the forum. Not a dumb question at all. We’re working on a larger-scale application and handle our pages by having a pages folder, which are the generic structure of our pages, and cards that are inserted into those generic pages. This is a link to our application:
Hopefully you can learn something from our design, and others can comment on whether it matches good practices.
I’m not sure how to handle passing objects between callbacks elegantly. If I need to pass a dataframe between callbacks I serialize the dataframe into a feather format, store it in redis, and then read the bytes from redis and deserialize them into a dataframe in the next step of the callback graph.
Because you’re moving objects between callbacks they do need to be serializable I think, conforming to an http format, I presume.
I have not taken an OOP approach to a Dash app before, but I did write up a guide on some practices to use when structuring a larger scale application.
Structuring a large Dash application - best practices to follow
Thank you for sharing your project! I will definitely check it out. That’s a great help!
Thank you for the link, I’ll definitely check it out!
@jkpeq For prospects enquiring to us here at Plotly about Dash and Dash Enterprise, I’ll often refer them to these two recent webinars my colleagues have hosted which provide great tips to performance and scale … many of which aren’t so much Dash specific tips, but python tips:
and if you want to peruse a range of real-world “in the wild” Dash apps (w mix of live apps, github repos, youtube videos, etc. as/where available), check out: