Re: Repositories Global only or contextual?
Thomas Presthus <[email protected]>
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Organization | Erus Encodia AS |
| Message-ID | <1390239936.21658.3.camel@thinkpad> |
Hello Caleb,
Your question doesn't appear to me as a DDD-concern, but rather one of
technical implementation.
From your domain's perspective, I guess you are concerned about getting
"tasks for the given user".
In order to make your code loose-coupled, and not having the repository
know anything about sessions and other mechanics for user management,
I'd recommend doing something like:
class Tasks {
Set<Task> getTasksBelongingTo(User user) { ... }
}
Thomas.
On Mon, 2014-01-20 at 10:01 -0600, Caleb Cushing wrote:
>
> So say I'm implementing a repository for a Todo app. We'll call it
> Tasks,
>
> class Tasks implements Set { ... }
>
> assume that for this a repository is just the set interface, and tasks
> are just strings
>
> for (Task t : Tasks) {
> System.out.println( t );
> }
>
> should this code iterate all of the tasks in the system? or
> should/could it simply iterate the tasks of the currently
> authenticated user?
>
> If it's all tasks how should one go about getting to just the users
> tasks?
>
>
>
------------------------------------
Yahoo Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/domaindrivendesign/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/domaindrivendesign/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo Groups is subject to:
http://info.yahoo.com/legal/us/yahoo/utos/terms/