reposense / RepoSense

Contribution analysis tool for Git repositories
https://reposense.org
MIT License
245 stars 154 forks source link

Immutable Model Classes #2225

Open georgetayqy opened 3 months ago

georgetayqy commented 3 months ago

What feature(s) would you like to see in RepoSense

The current implementation of the model classes does not always guarantee immutability. As such, there is a risk that modifying an instance of a model class may result in unintended side effects on other instances of the same or different model classes.

As such, we should look into refactoring the model classes such that operations that accepts objects or returns objects will return new instances of said object containing identical information as the original copy of the object.

Is the feature request related to a problem?

Related to #2119 and #2124.

If possible, describe the solution

We could start with the smaller model classes first, and attempt to turn them immutable first, before moving on to the more complex model classes.

If applicable, describe alternatives you've considered

N/A

Additional context

N/A