How SWIM works (Scala)
Scala3 code (>25k lines) compiles to two outputs:
| |
Scala.js web version
Runs in js, creating SVG plots Easy access => better for exploring system, illustrating points Open in a web browser, no installation, it just works Test relative sensitivity to policy options and scientific uncertainties Response time to parameter adjustments: ~ 0.5-5s |
JVM desktop version
Runs as java, reusing swing GUI from JCM Faster => better for systematic analysis Run scripts, probabilistic analysis of thousands of variants Simpler debugging for code in development Response time to to parameter adjustments: ~ 0.1-1s |
Yet both versions calculate exactly the same curves.
Scala3 - strongly typed, multi-paradigm, yet with readable syntax (minimal braces), is both reliable and flexible. SWIM shows how scala(3).js succeeds to run a complex model in a browser, fast, flexibly, robustly. So it's "scalable" in the sense that there is scope to increase complexity and resolution, scala code could also move from client to server for more complex / data-intensive science modules. |
Links: More about Scala-JS and Scala 3
Next: Model Doc + Code
(Overview)