Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use classes/dataclasses instead of dicts for internal data #1698

Open
2 tasks
Tracked by #1696
mwartell opened this issue Oct 17, 2022 · 1 comment
Open
2 tasks
Tracked by #1696

use classes/dataclasses instead of dicts for internal data #1698

mwartell opened this issue Oct 17, 2022 · 1 comment

Comments

@mwartell
Copy link
Collaborator

mwartell commented Oct 17, 2022

There are a number of internal data objects in Armory that make the code brittle and hard to reason about.

During early armory versions, it was convenient and speedy to use bag-of-properties dicts to marshal internal data structures. Adding a new dict key allows easy addition of parameters, but then users of that dict sometimes have to check for the presence of a member because the dict might not have it. This litters the code with conditionals which may or may not properly guard operations on missing elements. Because dicts allow random modification, mutations of these objects happen throughout the code which breaks locality.

We need to define some of these core objects better so that their members and semantics are locked down:

  • identify the application objects worth promoting
  • hunt down all mutations of those objects and localize them to the class

Example objects that we defined in tiga were Experiment, Credentials, Environment, Attack, Dataset, Metrics, Model, etc. The members of these are well defined and their contents and semantics mostly "locked-down" even in the present Armory. The lock-down needs to be more complete.

@mwartell
Copy link
Collaborator Author

Related to #1618

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant