The file system stores school reports. There are personal reports - personal for each school ( School class). And there are general reports - reports that contain general information / statistics on schools in the region.
Metadata (information about reports) is stored in the ReportMeta class and they are the same for both personal and general reports:
public class ReportMeta { public string Name { get; set; } public DateTime PublishDate { get; set; } public string OnlineLink { get; set; } //... } Algorithms for receiving ReportMeta for personal and general reports are different . Moreover, the ReportMeta receipt ReportMeta for personal reports is constant, but the code for general reports may change in the future, since The storage structure of these (general reports) will be different and it is planned to add other types of reports. So I made the disconnect:
public interface IReportMeta { IEnumerable<ReportMeta> GetReportMetas(); } public class PrivateReportMeta : IReportMeta { private School school; public PrivateReportMeta(School school) { this.school = school; } public IEnumerable<ReportMeta> GetReportMetas() { //… return new List<ReportMeta>(); } } public class PublicReportMeta : IReportMeta { public IEnumerable<ReportMeta> GetReportMetas() { //... return new List<ReportMeta>(); } } Client code needs to get ReportMeta lists in a common heap and therefore the following is assumed:
static void Main(string[] args) { School currentSchool = new School(); IReportMeta privateReportMetas = new PrivateReportMeta(currentSchool); IReportMeta publicReportMetas = new PublicReportMeta(); var allReportMetas = privateReportMetas.GetReportMetas().Union(publicReportMetas.GetReportMetas()); //... } Question
- Does the code follow the SOLID principles?
- Is there a gross violation in the design of the application?
I would be grateful for the proposal of another architecture.