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

Context redesign #63

Open
end2endzone opened this issue Oct 19, 2021 · 0 comments
Open

Context redesign #63

end2endzone opened this issue Oct 19, 2021 · 0 comments
Labels
code cleanup The code needs optimization enhancement

Comments

@end2endzone
Copy link
Owner

The application is storing all command line arguments to an ARGUMENTS structure. Then almost all field of this structure must be passed to IGenerator.

A Context should be created which contains all the configuration fields for generating code from an input file. The Context shall contains almost the same fields as the ARGUMENTS structure.

This would provide the following benefits:

  1. This Context shall be given to the IGenerator class for generating stuff. This would simplify the duplication of fields.
  2. The ARGUMENTS structure may sync with a Context which is filled in parallel.
  3. Creating "getters" directly in the Context class for each specified usage and generated fields. This would increase cohesion and reduce the coupling with the IGenerator interface. The generator interface would be more focused on generating code for a given context. The ARGUMENTS fields are mostly independent of the generator which is why an independent class would be preferable (instead of having all these fields in the BaseGenerator class).
  4. A Context shall be created for each files identified with the --dir option. The current implementation duplicated the ARGUMENTS structure which may be hard to understand or follow in the code.
  5. It would also simplify unit testing. For example with default values and values that are automatically calculated.
  6. Future changes will have a lower impact on the code. The changes will be targeted to the Context or the IGenerator interface. Not always both.
@end2endzone end2endzone added enhancement code cleanup The code needs optimization labels Oct 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code cleanup The code needs optimization enhancement
Projects
None yet
Development

No branches or pull requests

1 participant