|
|
|
|
|
by UK-AL
3280 days ago
|
|
In this case it isn't that bad since its only loading registered courses for that specific student. Which for a student would be limited(10?). In fact it should probably be a business rule inside RegisterForCourse that a student can only register for a specific amount of courses per semester. You normally need load an entire aggregate, so that you can maintain your invariants. If you separate into 3 aggregates such as Course, Student, CourseRegisteration then starts to become harder to maintain business rules. For example if you wanted the RegisterForCourse method to limit student course registration to 10, it would now have perform another query. If start doing queries that don't match up your domain model, then should probably do CQRS. Which would allow you to build a model optimized for queries. |
|
One day someone is going to want slightly different rules for student course registration and then they'll realise this rule is baked into the core and that's sad.