I am having StudentDriver as aggregate root. Each StudentDriver may have multiple DrivingLogs and each DrivingLog may hold multiple DrivingRecords.
Since they are connected to eachother I think it is right. However I don’t understand how if I am going to add a new drivingrecord for instance. Do I invoke studentdriver.addNewDrivingRecordToDrivingLog(…) or do I first get a drivinglog from the user and then add the drivingrecord to this. I mean, the method names are getting really long and I don’t understand how you are supposed to access elements.
Could someone explain how you are supposed to interact with the members of StudentDriver, and even if this aggregate is correct?
Looks like getting DrivingLog instance and then adding record to it would be better, but this really seems to be on of those things that you should figure out on your own because we don’t know enough about you domain. Both approaches don’t violate any DDD rules. Try one and change it later if you don’t like it (i.e. code smells, tests are hard etc). DDD code should be continuously improved along with your understanding of the domain. There is really no right or wrong in this situation.