<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://thoughtshapes.com" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>ThoughtShapes - Design - Comments</title>
 <link>http://thoughtshapes.com/taxonomy/term/6</link>
 <description>Comments for &quot;Design&quot;</description>
 <language>en</language>
<item>
 <title>Thank you for taking the</title>
 <link>http://thoughtshapes.com/node/21#comment-598</link>
 <description>&lt;p&gt;Thank you for taking the time to respond. Everything you said makes perfect sense, and it is nice to have this type of validation when coding DDD. &lt;/p&gt;
&lt;p&gt;I believe passing the Repository to the constructor makes more sense because we should argue that the Customer does not have the “knowledge” to know which repository to create, and therefore it is logical for CustomerFactory to do this job (and it works better with unit tests). So I agree with all your point.&lt;/p&gt;
&lt;p&gt;At this point, I am trying to use NHibrante to implement a prototype on this idea. When I am done, I will post it on my blog (&lt;a href=&quot;http://mikeperetz.blogspot.com/&quot; title=&quot;http://mikeperetz.blogspot.com/&quot;&gt;http://mikeperetz.blogspot.com/&lt;/a&gt;) I would love your feedback on it.&lt;/p&gt;
</description>
 <pubDate>Mon, 19 Nov 2007 22:01:51 -0500</pubDate>
 <dc:creator>Anonymous</dc:creator>
 <guid isPermaLink="false">comment 598 at http://thoughtshapes.com</guid>
</item>
<item>
 <title>Thanks for the complement on</title>
 <link>http://thoughtshapes.com/node/21#comment-597</link>
 <description>&lt;p&gt;Thanks for the complement on the article.  &lt;/p&gt;
&lt;p&gt;You raise an interesting (and common) problem.  If I were to implement lazy loading here to deal with the customer who had placed a million orders I would allow the Customer class to interact with an interface to an order repository (IOrderRepository).  It would obtain an implemenation of that interface by calling a repository factory object to get the concrete implemenation and then use that to retrieve a smaller subset of the data.  Using your example of a date range I would implement the customer get order method like so:&lt;/p&gt;
&lt;pre class=&quot;code cs&quot;&gt;
public class Customer
{
      IList GetOrders(DateTime from, DateTime to)
      {
           return RepositoryFactory.OrderRepository.GetOrders(this, from, to);
       }
}&lt;/pre&gt;&lt;p&gt;
Now since the Customer class is really referring to an IOrderRepository, I&#039;d say that the Repository interface lives in the domain (with its client), and the concrete implementations live in their own namespaces (and probably assemblies).  &lt;/p&gt;
&lt;p&gt;Note that although I&#039;m using a RepositoryFactory in this example, I might provide the indirection by just passing the IOrderRepository to the Customer when I created it.  (This implies that whatever object created the Customer object would get the concrete implementation from the RepositoryFactory because we still want that run-time configurability.)   I usually determine whether or not to pass the repository instances to the object on its constructor or have it use the RepositoryFactory directly based upon whether the object uses multiple repositories.  If it uses one or two different repositories, I pass the instances, otherwise I just have the object use the RepositoryFactory to get the instances.&lt;/p&gt;
&lt;p&gt;Does that make sense to you?&lt;/p&gt;
</description>
 <pubDate>Mon, 19 Nov 2007 12:19:00 -0500</pubDate>
 <dc:creator>Rob Scott</dc:creator>
 <guid isPermaLink="false">comment 597 at http://thoughtshapes.com</guid>
</item>
<item>
 <title>First of all, you wrote a</title>
 <link>http://thoughtshapes.com/node/21#comment-596</link>
 <description>&lt;p&gt;First of all, you wrote a very nice article. I think you are touching very fundamental issues. I am studying DDD now, and having trouble with a few scenarios.&lt;/p&gt;
&lt;p&gt;Where do Repositories live? I feel that I am very limited if the repositories live within the Application layer only. I think lazy loading becomes a must in one point, because you don’t want to bring too much data from the database.&lt;/p&gt;
&lt;p&gt;I also feel, that if you were to implement Specification pattern (Evens), then again you need the Repositories. Having said that, I think you should only use interfaces to them, and never use their true implementation. &lt;/p&gt;
&lt;p&gt;When coding I sometime have a “the million rule”, what if there is a million orders to a customer. Or what if there are a million history records for a transaction. We should never bring that type of data down. We should probably use Query Pattern, which will work with Repositories.&lt;/p&gt;
&lt;p&gt;Now I wonder, if I was to create a Customer and Order classes… does this makes snese?&lt;/p&gt;
&lt;p&gt;List orders = customer.GetOrders(); // use Repository to implement this&lt;br /&gt;
Or&lt;br /&gt;
List order = customer.GetOrders(DateTime fromDate) // use Repository with Query pattern&lt;/p&gt;
&lt;p&gt;What about adding an order?&lt;br /&gt;
customer.AddNewOrder(order);&lt;/p&gt;
&lt;p&gt;Does code like that is DDD? If yes, the Repositories do live within the domain… &lt;/p&gt;
&lt;p&gt;What is your take on this?&lt;br /&gt;
(Let’s assume that you can have a million orders per customer)&lt;/p&gt;
</description>
 <pubDate>Sun, 18 Nov 2007 10:10:13 -0500</pubDate>
 <dc:creator>Anonymous</dc:creator>
 <guid isPermaLink="false">comment 596 at http://thoughtshapes.com</guid>
</item>
<item>
 <title>Office 2000/2003 version of</title>
 <link>http://thoughtshapes.com/node/68#comment-594</link>
 <description>&lt;p&gt;Office 2000/2003 version of documents have been attached to this posting.&lt;/p&gt;
</description>
 <pubDate>Sat, 03 Nov 2007 00:09:11 -0400</pubDate>
 <dc:creator>Rjae Easton</dc:creator>
 <guid isPermaLink="false">comment 594 at http://thoughtshapes.com</guid>
</item>
<item>
 <title>Hi Robert!
What you say</title>
 <link>http://thoughtshapes.com/node/70#comment-593</link>
 <description>&lt;p&gt;Hi Robert!&lt;/p&gt;
&lt;p&gt;What you say makes a lot of sense, no surprise there, but I&#039;m currently working on a project where the decision to use a particular database technology was made early on... pretty much at the beginning.  Why?  Well I don&#039;t want to use the wimpy excuse that &quot;I wasn&#039;t working on the project at the time this decision was made&quot;, and even if I was I might not have been in position to directly work around this decision.   Some of the decisions to select a database early were based on the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Our product is a website that we want to achieve scale on.  And we wanted to be able to make performance measurements ASAP. &lt;/li&gt;
&lt;li&gt; A database brings decades of doing certain things well.  And we wanted to leverage that &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Having said that, I also should tell you that:  A) We are using Agile just as you describe  and B) I &amp;gt;think&amp;lt; we used something akin to the repository concept in order to isolate the DB from other production code so that the other groups (we have multiple scrum teams running) wouldn&#039;t be blocked.  I say Akin because we don&#039;t have a true in memory repository.  We use NMock to &quot;stub&quot; out interfaces and inject test data.&lt;br /&gt;
With both of these statements, we are in a position (should we need to go in this direction) where we could change the DB, remove the DB etc, in a &quot;safe&quot;: we have unit tests to catch dependencies but is anything truly 100% safe ;), and speedy (in a sprint) manner.   &lt;/p&gt;
&lt;p&gt;Having said all that, I do struggle (as I mentioned to Rjae) with the fact that we have what some people would consider business logic written into stored procedures, and I worry what the implications of changing the DB technologies would be underneath the interfaces we have.&lt;/p&gt;
&lt;p&gt;So I have no problem with you saying &quot;start with an in memory repository first.&quot;  I truly feel that Agile and your 4th point &quot;I’d make remaining neutral with respect to the piece of technology a design requirement and ensure that the development team knew to isolate that decision behind the appropriate interfaces&quot; above are the ones that help us rule the day.  &lt;/p&gt;
&lt;p&gt;Great post!  There is a TON of good material here.  I&#039;ll come back to this post frequently.&lt;/p&gt;
</description>
 <pubDate>Fri, 02 Nov 2007 20:24:09 -0400</pubDate>
 <dc:creator>Jay</dc:creator>
 <guid isPermaLink="false">comment 593 at http://thoughtshapes.com</guid>
</item>
<item>
 <title>Much of the material is</title>
 <link>http://thoughtshapes.com/node/68#comment-584</link>
 <description>&lt;p&gt;Much of the material is based on Robert C. Martin&#039;s &lt;a href=&quot;http://www.amazon.com/Software-Development-Principles-Patterns-Practices/dp/0135974445/ref=sr_1_2/104-9536311-7327920?ie=UTF8&amp;amp;s=books&amp;amp;qid=1193417002&amp;amp;sr=8-2&quot;&gt;Agile Software Development, Principles, Patterns, and Practices&lt;/a&gt;. There is also a new &lt;a href=&quot;http://www.amazon.com/Principles-Patterns-Practices-Robert-Martin/dp/0131857258/ref=sr_1_1/104-9536311-7327920?ie=UTF8&amp;amp;s=books&amp;amp;qid=1193417002&amp;amp;sr=8-1&quot;&gt;C#-only revision&lt;/a&gt;.&lt;/p&gt;
</description>
 <pubDate>Fri, 26 Oct 2007 12:45:43 -0400</pubDate>
 <dc:creator>Rjae Easton</dc:creator>
 <guid isPermaLink="false">comment 584 at http://thoughtshapes.com</guid>
</item>
</channel>
</rss>
