Skip to content

Context class redesign. Move arguments handling into a Context class. #63

@end2endzone

Description

@end2endzone

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).
     
    Fields in the Context class are public and can be set/get directly without using a method.
  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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions