Re: Repositories Global only or contextual?
Ryan Barrett <[email protected]>
| Newsgroups | gmane.comp.programming.domain-driven-design |
|---|---|
| Message-ID | <CAKhPsH9BW01R7ga1TBmjziU+VnQOaMJqB1pzs7bCou6iqKT3WQ@mail.gmail.com> |
The whole infinite scrolling idea technical - in a massively distributed system such as twitter/facebook, it's very hard (expensive) to provide an exact size of a list. Plus, for most users the list is effectively infinite.. Paging, and to a lesser extent filtering on the set-based repository methods is part of the domain. You're modelling "give me all albums by the Rolling Stones, but do it 10 at a time because I can't carry all of them in one go". Of course you should try to implement this efficiently, and in a way that doesn't distract from the semantics of the domain. This often means deciding between passing expressions/query objects (which can handle AND/OR/NOT) or simple constraint lists (which can handle AND). For example, I've seen people implement filtering on the UI which sent a string expression tree to the webserver, which parsed the expression string into an expression tree which was compiled to SQL in the Repository implementation (well, DAL, they weren't using the repository patter). That worked well, the conversions were handled by framework infrastructure so the domain code wasn't cluttered. But it obviously took a lot of work to get right... -- Ryan On 27 January 2014 21:22, Caleb Cushing <[email protected]> wrote: > > > I've been dead for the last week with a sickness. But thanks all for the > input. > > On Fri, Jan 24, 2014 at 2:10 PM, <[email protected]> wrote: > >> But most repositories suffer from infrastructure leakage - take most >> basic feature of paging. Paging will require additional arguments on your >> methods or type signature suited for such operations. Neither of those is >> part of your domain, but you need to have it or you will have performance >> issues. >> >> Actually, I'm not entirely convinced on some reflection that Paging isn't > part of the Domain. One of the principles of DDD is to ask, if you remove > the computer, how is it done? take books, if I remove the computer would I > print things on a scroll and unroll it.... No, because people don't > actually like to consume things that way, it's too much information. We > tend to think of this as a machine perfomance issue only, or a screen > realestate issue, but I think there's truth that we as people don't want to > consume an infinite list. I've found a few of the sites that provide said > infinite scrolling to have rather frustrating user interfaces (personal > opinion). When the list size is known, and it's seems humanly consumable > it's not so bad. When reviewing a checkbook balance log, we eventually have > to turn the page. I'm not 100% on this, but I think we may to some extent > assume that the "technology" was the reason for this, but I think the human > factor is the reason we stopped using scrolls, and humans are a domain > concern (IMHO). > > > -- > Caleb Cushing > > http://xenoterracide.com > > Calendar: > > https://www.google.com/calendar/embed?src=xenoterracide%40gmail.com&ctz=America/Chicago > > > >