I'm making the switch to a more object-oriented approach to ASP.NET web applications in a new system I'm developing.
I have a common structure which most people will be familiar with. I have a school structure where there are multiple departments; courses belonging to a single department; and students belonging to multiple courses.
In a department view I list all courses belonging to the department and I want aggregated figures for each course such as number of enrolments, withdrawals, number male/female etc.
In an individual course view however, I'll need the actual list of students along with their details such as whether they are enrolled, passed course, gender etc.
And then the individual student view where all detail about a student is displayed including enrolments on other courses, address, etc.
Previously, I would have had a data access layer returning whatever data I needed in each case and returning it as an SQLDataReader
or DataSet
(working in VB.NET). Now, I'm trying to model this in an object-oriented approach I'm creating objects in the DAL and returning these to the BLL. I'm not sure how to handle this though when I need aggregated details in objects. For example, in the department view with the list of courses I'll have aggregates for each of the courses. Would I store a collection of some lightweight course objects in the department where those lightweight course objects store the aggregated values?
I guess there are different levels of abstraction needed in different scenarios and I'm not sure the best way to handle this. Should I have an object model where there's a very basic course object which stores aggregates, and a child object which would store the full detail?
Also, if there are any useful resources that may help my understanding of how to model these kind of things that'd be great.