Should the reporting logic to extract domain data in a certain format reside in domain objects or separate reporting objects? The reporting logic needs to:
- select entities/data which match selection criteria e.g. date range
- apply data validation rules e.g. date range, boundary values, missing values
apply type of reporting specific validation rules
a. The rules will vary depending on type of domain object i.e. a certain domain object will require additional rules or different rule validation logic
transform data in certain format
a. Depending on domain object, number of fields may vary in the output
Solution Design
- Should there be parallel hierarchy between reporting classes and domain classes?
- The reporting classes will interact with domain classes through domain class interface
- A context object would be needed to create domain object specific validator objects so that report generator can have generic logic
Does this look like a good approach or am I approaching it incorrectly?