InstituteforDiseaseModeling / covasim

COVID-19 Agent-based Simulator (Covasim): a model for exploring coronavirus dynamics and interventions
https://covasim.org
MIT License
250 stars 223 forks source link

apply aggregate patterns to defaults #318

Closed CelinaAssal closed 2 years ago

CelinaAssal commented 3 years ago

Problem

Currently, several methods within defaults.py deal with similar areas (such as getting statistics, for example). Although this is so, they are separated into different methods and there is nothing tying them together as a single unit.

Solution

Having separate methods is good, but we also want a way to identify how certain objects are tied together. A solution to this is applying aggregates. This allows for clarity in domain driven design. Additionally, it allows for invariants to be applied and maintained to closely related objects, rather than having it applied to each object individually.

How?

This was done by adding roots for Statistics, Colors, and Plots. As these are our roots, we can treat the methods within them as a single unit when it comes to things such as invariants.

Please Note**** that these changes are part of a school project.

cliffckerr commented 2 years ago

Thanks for the PR -- we're not considering major architectural changes currently, but we appreciate the contribution to open-source software!