﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>morcs commented on Taking a look at S#arp Lite, Part II&amp;ndash;the domain</title><description>@Falhar I'm pretty sure the ID has to have a protected (non-private) setter so that nHibernate can set it through reflection when loading an entity.</description><link>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment19</link><guid>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment19</guid><pubDate>Mon, 05 Mar 2012 13:31:31 GMT</pubDate></item><item><title>Falhar commented on Taking a look at S#arp Lite, Part II&amp;ndash;the domain</title><description>@Owen No. That means OrderLineItem shouldn't reference Order and Order shouldn't reference Customer. Eg. make the relation directional.
This is explained in DDD book and leads to model, that is easier to understand.

I think thats what Ayende means.</description><link>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment18</link><guid>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment18</guid><pubDate>Sat, 03 Mar 2012 07:53:11 GMT</pubDate></item><item><title>Owen commented on Taking a look at S#arp Lite, Part II&amp;ndash;the domain</title><description>"Probably the worst point of this object model is that it is highly connected, which encourages people to try to walk the object graphs where they should issue a separate query instead."

Ayende, are you saying that the models should be segregated at the aggregate boundaries, e.g. Order should only reference CustomerId, not the Customer model? Doesn't that defeat the power of an ORM?

As a NHibernate user, I don't see "connecting" the models as a way or excuse to walk the object graph, its advantage is in ease of writing HQL, DetachedCriteria and linq queries. And all queries should be explicit about which associations or collections to eager load.

</description><link>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment17</link><guid>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment17</guid><pubDate>Fri, 02 Mar 2012 22:45:46 GMT</pubDate></item><item><title>Lev Gorodinski commented on Taking a look at S#arp Lite, Part II&amp;ndash;the domain</title><description>"Probably the worst point of this object model is that it is highly connected, which encourages people to try to walk the object graphs where they should issue a separate query instead."

I completely agree. I see this symptom very often and it is a sign of a misguided understanding of how to apply DDD. The notion of a read model, reporting object, or DTO doesn't seem to be very well expressed as a core pattern in applying DDD.</description><link>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment16</link><guid>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment16</guid><pubDate>Fri, 02 Mar 2012 22:15:38 GMT</pubDate></item><item><title>Jeff commented on Taking a look at S#arp Lite, Part II&amp;ndash;the domain</title><description>"Probably the worst point of this object model is that it is highly connected, which encourages people to try to walk the object graphs where they should issue a separate query instead."

I couldn't agree more!</description><link>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment15</link><guid>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment15</guid><pubDate>Fri, 02 Mar 2012 21:48:08 GMT</pubDate></item><item><title>Ryan commented on Taking a look at S#arp Lite, Part II&amp;ndash;the domain</title><description>@YovannyR - I keep seeing people link to that video, but I checked out his blog and it's slow, unintuitive, and does not cooperate with a scrolling mouse. Not exactly ground breaking if you ask me.</description><link>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment14</link><guid>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment14</guid><pubDate>Fri, 02 Mar 2012 18:28:56 GMT</pubDate></item><item><title>Khalid Abuhakmeh commented on Taking a look at S#arp Lite, Part II&amp;ndash;the domain</title><description>"It is the same as saying that by changing the shirt I wear, I become a completely different person." 

I think a lot of fashion designers would agree with this statement :P</description><link>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment13</link><guid>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment13</guid><pubDate>Fri, 02 Mar 2012 14:32:22 GMT</pubDate></item><item><title>YovannyR commented on Taking a look at S#arp Lite, Part II&amp;ndash;the domain</title><description>Look at the new programming style! where? apple of course! Bret Victor
http://vimeo.com/36579366</description><link>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment12</link><guid>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment12</guid><pubDate>Fri, 02 Mar 2012 14:23:30 GMT</pubDate></item><item><title>Wayne M commented on Taking a look at S#arp Lite, Part II&amp;ndash;the domain</title><description>In dealing with a scenario where you need, say, the Customer name and the corresponding Orders I thought the preferred approach was to use a "view" or "DTO" object that exposes just what you need?

I mainly work with WebForms, not MVC, so in my case I would have one Presenter/ViewModel per screen, so a screen that lists out orders by Customer would include just the specific customer information I need on that screen.  I suppose in MVC you could do the same thing using a ViewModel.</description><link>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment11</link><guid>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment11</guid><pubDate>Fri, 02 Mar 2012 13:31:15 GMT</pubDate></item><item><title>Bystrik Jurina commented on Taking a look at S#arp Lite, Part II&amp;ndash;the domain</title><description>Mauro, I think it's a good practice to separate your read operations from writes, especially if presentation needs pieces of data from different entitites. Maybe not in the strict CQRS way, but you could have DB Views including columns of related entities(e.g. Orders DB view containing CustomerId and CustomerName columns and so on)In this way you have only flat objects and automatic query generations from grids(telerik grid, jqGrid) is way easier.
</description><link>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment10</link><guid>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment10</guid><pubDate>Fri, 02 Mar 2012 12:56:26 GMT</pubDate></item><item><title>Felice Pollano commented on Taking a look at S#arp Lite, Part II&amp;ndash;the domain</title><description>Not related to S#Sharp, but about the model, I would prefer the so called Query Object Pattern, in which the OR/M query receive a dignity of complexity and insulation. Always exposing IQueryable is not the key in order to me, but providing some objects that easily expose the essential information  we need to query the model and obtain the result in the preferred shape. </description><link>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment9</link><guid>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment9</guid><pubDate>Fri, 02 Mar 2012 11:18:03 GMT</pubDate></item><item><title>Mauro commented on Taking a look at S#arp Lite, Part II&amp;ndash;the domain</title><description>"Probably the worst point of this object model is that it is highly connected"

I have a similar problem in my domain: getting an Order you probably want to see also the Customer name; do you create two properties CustomerId and CustomerName in the Order entity or what else?</description><link>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment8</link><guid>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment8</guid><pubDate>Fri, 02 Mar 2012 11:09:28 GMT</pubDate></item><item><title>Falhar commented on Taking a look at S#arp Lite, Part II&amp;ndash;the domain</title><description>What is difference between Object Signature and Identity? Because those are not equal with ComparableObject and Entity hiearchy.</description><link>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment7</link><guid>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment7</guid><pubDate>Fri, 02 Mar 2012 11:08:12 GMT</pubDate></item><item><title>seif commented on Taking a look at S#arp Lite, Part II&amp;ndash;the domain</title><description>@DaeMoohn if the entity is not persisted, then it uses the GetHashCode on ComparableObject, so you wouldn't get the entity persisted multiple times.</description><link>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment6</link><guid>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment6</guid><pubDate>Fri, 02 Mar 2012 10:58:32 GMT</pubDate></item><item><title>DaeMoohn commented on Taking a look at S#arp Lite, Part II&amp;ndash;the domain</title><description>So you could end up with the same entity persisted multiple times in the database?</description><link>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment5</link><guid>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment5</guid><pubDate>Fri, 02 Mar 2012 10:35:21 GMT</pubDate></item><item><title>seif commented on Taking a look at S#arp Lite, Part II&amp;ndash;the domain</title><description>GetHashCode and Equals are overriden in the entity class:
https://github.com/codai/Sharp-Lite/blob/master/SharpLiteSrc/app/SharpLite.Domain/Entity.cs

and use the Id if the entity is persisted.</description><link>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment4</link><guid>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment4</guid><pubDate>Fri, 02 Mar 2012 10:28:45 GMT</pubDate></item><item><title>Falhar commented on Taking a look at S#arp Lite, Part II&amp;ndash;the domain</title><description>Yes. For entities, equality, identity and hash should be only on Id. Nothing else.

If you want to use FirstName and LastName as identity, you should create custom value object and use that as Id.

Also, why is setter of Id protected? It should never be possible to change the Id once entity is created/persisted. So it should be private.</description><link>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment3</link><guid>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment3</guid><pubDate>Fri, 02 Mar 2012 10:20:43 GMT</pubDate></item><item><title>DaeMoohn commented on Taking a look at S#arp Lite, Part II&amp;ndash;the domain</title><description>I think DomainSignature attribute is used to calculate the identity of the entity. I am surprised he didn't go as far as override the Equals methods. 

Taken from DDD Blue Book: "An Entity is an object fundamentally defined not by its attributes, but by a thread of continuity and identity." 

When you change the primordial attributes that define the identity of the entity, that's another entity. An entity isn't defined by the ID in the database (if you are saving it in a database after all). What you are saying is that he should have made them immutable. That a desirable thing, but not always possible.</description><link>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment2</link><guid>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment2</guid><pubDate>Fri, 02 Mar 2012 10:12:01 GMT</pubDate></item><item><title>Martino Bordin commented on Taking a look at S#arp Lite, Part II&amp;ndash;the domain</title><description>Hi Ayende, I agree with you about DomainSignature for entities.

However, do you think it's a suitable way to compare Value Objects?</description><link>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment1</link><guid>http://ayende.com/153473/taking-a-look-at-s-arp-lite-part-ii-the-domain#comment1</guid><pubDate>Fri, 02 Mar 2012 10:11:46 GMT</pubDate></item></channel></rss>