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

Make all constructors side-effect-free #16

Open
vinjana opened this issue Jan 30, 2024 · 0 comments
Open

Make all constructors side-effect-free #16

vinjana opened this issue Jan 30, 2024 · 0 comments

Comments

@vinjana
Copy link
Member

vinjana commented Jan 30, 2024

Currently, there is code, that just instantiates an instance -- even without parameters, using the a default constructor -- that parses from the input. A nightmare for maintenance and code clarity.

Extract all parsing code from constructors.

Note that this is not easy, because also the business logic and the index-mapping leakage is intertwined with the parse code.

Implementation Suggestion

  1. Parse the input into an abstract table structure (without types; e.g. using rapidcsv, which is already used by SOPHIA > 35.0.0).
  2. Parse and interpret the fields into objects. This may be possible with rapidcsv already (with constructors that take strings), but better would be to have static parse functions or even to have a factory or dedicated parser class(es), or so (to keep the parse code out of the objects).
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