Understanding Domain Driven Design

Posted by Nihilist on Stack Overflow See other posts from Stack Overflow or by Nihilist
Published on 2010-06-11T05:05:16Z Indexed on 2010/06/11 5:12 UTC
Read the original article Hit count: 285

Hi I have been trying to understand DDD for few weeks now. Its very confusing. I dont understand how I organise my projects. I have lot of questions on UnitOfWork, Repository, Associations and the list goes on...

Lets take a simple example. Album and Tracks. Album: AlbumId, Name, ListOf Tracks Tracks: TrackId, Name

Question1: Should i expose Tracks as a IList/IEnumerabe property on Album ? If that how do i add an album ? OR should i expose a ReadOnlyCollection of Tracks and expose a AddTrack method?

Question2: How do i load Tracks for Album [assuming lazy loading]? should the getter check for null and then use a repository to load the tracks if need be?

Question3: How do we organise the assemblies. Like what does each assembly have? Model.dll - does it only have the domain entities? Where do the repositories go? Interfaces and implementations both. Can i define IAlbumRepository in Model.dll? Infrastructure.dll : what shold this have?

Question4: Where is unit of work defined? How do repository and unit of work communicate? [ or should they ] for example. if i need to add multiple tracks to album, again should this be defined as AddTrack on Album OR should there a method in the repository? Regardless of where the method is, how do I implement unit of work here?

Question5: Should the UI use Infrastructure..dll or should there be ServiceLayer?

Do my quesitons make sense?

Regards

© Stack Overflow or respective owner

Related posts about domain

Related posts about repository