Increase modularity and code reuse
Breaking up your application into smaller, self-contained components is always a good development practice because it makes the code reusable and easier to maintain. The PixieApp framework provides two ways to create and run reusable components:
- Dynamically invoking other PixieApps with the
pd_app
attribute - Packaging part of an application as a reusable widget
Using the pd_app
attribute, you can dynamically invoke another PixieApp (we'll call it child PixieApp from here on) by its fully qualified class name. The output of the child PixieApp is placed in the host HTML element (usually a div element) or in a dialog by using the runInDialog=true
option. You can also initialize the child PixieApp using the pd_options
attribute, in which case the framework will invoke the corresponding route.
To better understand how pd_app
works, let's rewrite our WordCloud
application by refactoring the code that generates the WordCloud
image in its own PixieApp that...