Hi,
I am just confused on the approach. Pls suggest me which is best. I will be creating multiple reports. SalesReport, ProfitReport etc.
Approach - 1:
class Report
{
ReportType type;
}
Subclass ReportType as SalesType, ProfitType and assign it to report instances
SalesReport:
Report sales = new Report();
sales.type = new SalesType();
ProfitReport:
Report profit = new Report();
profit.type = new ProfitType();
Approach 2:
class Report
{
}
class SalesReport : Report
{
SalesType type;
}
class ProfitReport : Report
{
ProfitType type;
}
Which approach is best? and best design? Thanks a lot.
Every report will have different criterias, different output options like Email, print etc.
class Report
{
ReportType type;
Criteria criteria;
Output output;
}
These classes are used like a Entity classes. For e.g from a browser/client we'll get the xml <Report><Type>Sales</Type><Criteria>...</Criteria></Report>
. Based on the XML I need to form the Report classes and pass it for processing. Based on report type it will be executed.