InstituteforDiseaseModeling / covasim

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

Applying Creational Pattern in Parameters.py #357

Closed ixuh12 closed 3 years ago

ixuh12 commented 3 years ago

Changes I select builder pattern from creational pattern to apply to this project which enables the part I changed work more efficiently and easier for programmers to add or modify its feature in the future.

How In Parameter.py, around Line 405, there are six types of different vaccines and each of them has the same five attributes. I add a Builder class to merge the same attributes among them. Therefore, different types of vaccines can be built from different builders. And if there are more attributes updated in the future, it can be easily applied to the different types of vaccines.

Note This is a course project.