Re: How to model this behaviour on multiple aggregates?

"[email protected] [domaindrivendesign]" <[email protected]> 22 Jun 2016 01:43:23 -0700
Newsgroups gmane.comp.programming.domain-driven-design
Message-ID <[email protected]>
--9nlWnTS9ocNmxdhsK3FKVLWiM6a5jwOaA8HvrLV
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset="UTF-8"

U29tZSBxdWljayB0aG91Z2h0cy4uLg0KDQpBc3N1bWU6DQoNCjEuIFByZXZpb3VzbHkgcmVsYXRp
b25zaGlwcyB3ZXJlIGF0dHJpYnV0ZXMgb2YgYSBQZXJzb24uDQoNCjIuIFRoYXQgeW91IG5vdyB3
YW50IHRvIHJlcHJlc2VudCBhIFJlbGF0aW9uc2hpcCBhcyBpdCdzIG93biBjb25jZXB0Lg0KDQoz
LiBUaGF0IHlvdSBkZWZpbmUgYSBSZWxhdGlvbnNoaXAgKGZvciBub3cpIGFzIHNvbWUgY29ubmVj
dGlvbiBiZXR3ZWVuIHR3byBwZW9wbGUgKFBlcnNvbiksIHN1Y2ggYXMgYSBtYXJyaWFnZSwgZnJp
ZW5kc2hpcCwgY28taGFiaXRhdGlvbiwgb3IgY29tbW9uLWxhdyBwYXJ0bmVyc2hpcCBldGMuDQoN
CjQuIFJlbGF0aW9uc2hpcCBjb3VsZCBiZSBmdXJ0aGVyIGJyb2tlbiBvdXQgaW50byBpbmRpdmlk
dWFsIGNvbmNlcHRzIGxpa2UgTWFycmlhZ2UgYW5kIEZyaWVuZHNoaXAsIGJ1dCBmb3Igbm93IGFz
c3VtZSB0aGlzIGlzbid0IHJlcXVpcmVkLg0KDQo1LiBGb3Igbm93IGlnbm9yZSB0aGUgY29uc3Ry
YWludCAoYnVzaW5lc3MgcnVsZSkgdGhhdCBvbmUgY2Fubm90IGJlIG1hcnJpZWQgdG8gMiBwZW9w
bGUgYXQgdGhlIHNhbWUgdGltZSBmb3Igc2ltcGxpY2l0eS4gIElmIGludGVyZXN0ZWQsIGNhbiBp
bmNsdWRlIHRoaXMuDQoN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FpbnRzIChidXNpbmVzcyBydWxlcykgY2FuIGJlIHBsYWNlZCB3aXRoaW4gdGhlIHByb3BlciBj
b25jZXB0IGJlY2F1c2Ugb2YgcG9pbnQgMi4gIEEgUGVyc29uIHNob3VsZCBub3Qga25vdyBvZiB0
aGUgY29uc3RyYWludHMgb2YgbWFycmlhZ2UsIGZyaWVuZHNoaXAgZXRjLiwgUmVsYXRpb25zaGlw
IHNob3VsZC4gIExpa2V3aXNlLCBhIFJlbGF0aW9uc2hpcCBzaG91bGQgbm90IGtub3cgdGhlIGNv
bnN0cmFpbnRzIG9mIGEgUGVyc29uLiAgSG93ZXZlciwgd2hlbmV2ZXIgY3JlYXRpbmcgb3IgZGVs
ZXRpbmcgYSBjb25uZWN0aW9uIGJldHdlZW4gdGhlIHR3bywgYm90aCBzZXRzIG9mIGNvbnN0cmFp
bnRzIHNob3VsZCBiZSBldmFsdWF0ZWQuDQoNCjUuIENvbnNpZGVyIGxhenkgbG9hZGluZyB0byBu
b3QgaW52b2x2ZSByZWxhdGVkIGNvbmNlcHRzIHdoZXJlIG5vdCByZXF1aXJlZC4=


--9nlWnTS9ocNmxdhsK3FKVLWiM6a5jwOaA8HvrLV
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit





<head>

<style type="text/css">
<!--

/* start of attachment style */
       .ygrp-photo-title{
         clear: both;
         font-size: smaller;
         height: 15px;
         overflow: hidden;
         text-align: center;
         width: 75px;
       }
       div.ygrp-photo{
         background-position: center;
         background-repeat: no-repeat;
         background-color: white;
         border: 1px solid black;
         height: 62px;
         width: 62px;
       }

       div.photo-title 
         a,
         div.photo-title a:active,
         div.photo-title a:hover,
         div.photo-title a:visited {
           text-decoration: none; 
       }

       div.attach-table div.attach-row {
         clear: both;
       }

       div.attach-table div.attach-row div {
         float: left;
         /* margin: 2px;*/
       }

       p {
         clear: both;
         padding: 15px 0 3px 0;
	 overflow: hidden;
       }

       div.ygrp-file {
         width: 30px;
         valign: middle;
       }
       div.attach-table div.attach-row div div a {
         text-decoration: none;
       }

       div.attach-table div.attach-row div div span {
         font-weight: normal;
       }

       div.ygrp-file-title {
         font-weight: bold;
       }
 /* end of attachment style */
        -->
        </style>
        </head>
<html>
<head>
<style type="text/css">
<!--
#ygrp-mkp {
  border: 1px solid #d8d8d8;
  font-family: Arial;
  margin: 10px 0;
  padding: 0 10px;
}

#ygrp-mkp hr {
  border: 1px solid #d8d8d8;
}

#ygrp-mkp #hd {
  color: #628c2a;
  font-size: 85%;
  font-weight: 700;
  line-height: 122%;
  margin: 10px 0;
}

#ygrp-mkp #ads {
  margin-bottom: 10px;
}

#ygrp-mkp .ad {
  padding: 0 0;
}

#ygrp-mkp .ad p {
  margin: 0;
}

#ygrp-mkp .ad a {
  color: #0000ff;
  text-decoration: none;
}
-->
</style>
</head>
<body>



<!-- |**|begin egp html banner|**| -->

<br><br>

<!-- |**|end egp html banner|**| -->


Some quick thoughts...<br><br>Assume:<br><br>1. Previously relationships were attributes of a Person.<br><br>2. That you now want to represent a <span style="font-weight:bold;"><span>Relationship </span></span>as it&#39;s own concept.<br><br>3. That you define a Relationship (for now) as some connection between <span style="font-style:italic;">two </span>people (<span style="font-weight:bold;">Person</span>), such as a marriage, friendship, co-habitation, or common-law partnership etc.<br><br>4. <span style="font-weight:bold;">Relationship</span> could be further broken out into individual concepts like <span style="font-weight:bold;">Marriage </span>and <span style="font-weight:bold;">Friendship</span>, but for now assume this isn&#39;t required.<br><br>5. For now ignore the constraint (b
 usiness rule) that one cannot be married to 2 people at the same time for simplicity.&nbsp; If interested, can include this.<br><br><br>Notes:<br><br>1. One now has two concepts - <span style="font-weight:bold;">Person </span>and <span style="font-weight:bold;">Relationship</span><br><br>2. Marry, Divorce, Separation, MakeFriend, UnFriend etc., are behaviors of the <span style="font-weight:bold;">Relationship </span>concept, <span style="font-style:italic;">not </span>the <span style="font-weight:bold;">Person</span>.&nbsp; In an object-oriented approach, an action on an object in the real world, becomes a behavior of the object being acted on.&nbsp; <span style="font-weight:bold;">Relationship </span><span style="font-style:italic;">knows about</span> marriage, friendships etc, not a <s
 pan style="font-weight:bold;">Person</span>.&nbsp; A <span style="font-weight:bold;">Nail </span>knows how to be <span style="font-style:italic;">Hit</span>, not the <span style="font-weight:bold;">Hammer</span>.<br><br>3. Further to point 2, the <span style="font-style:italic;">Marry </span>behavior of Relationship needs to be supplied with 2 people (Person).<br><br>4. Further to point 3, the <span style="font-style:italic;">Marry </span>behavior of Relationship will be called and supplied with 2 people by something outside the domain within a transactional boundary by default.&nbsp; Are you Facebook?&nbsp; Look to a different transactional solution.<br><br>5. Constraints (business rules) can be placed within the proper concept because of point 2.&nbsp; A <span style="font-weight:bold;"
 ><span>Person </span></span>should not know of the constraints of marriage, friendship etc., <span style="font-weight:bold;"><span>Relationship </span></span>should.&nbsp; Likewise, a <span style="font-weight:bold;">Relationship </span>should not know the constraints of a <span style="font-weight:bold;">Person</span>.&nbsp; However, whenever <span style="font-style:italic;">creating </span>or <span style="font-style:italic;">deleting </span>a connection between the two, both sets of constraints should be evaluated.<br><br>5. Consider lazy loading to not involve related concepts where not required.



<!-- |**|begin egp html banner|**| -->

<br>


<br>

<!-- |**|end egp html banner|**| -->


<div width="1" style="color: white; clear: both;"/>__._,_.___</div>

      
  

    
    <div id="fromDMARC" style="clear:both; margin-top: 10px;">
         <hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
         Posted by: [email protected]         <hr style="height:2px ; border-width:0; color:#E3E3E3; background-color:#E3E3E3;">
    </div>
<!-- Start Recommendations -->
<!-- End Recommendations -->



<!-- |**|begin egp html banner|**| -->

  <img src="http://geo.yahoo.com/serv?s=97476590/grpId=8116923/grpspId=1705007181/msgId=24776/stime=1466624565" width="1" height="1"> <br>

<!-- |**|end egp html banner|**| -->

  
<!-- |**|begin egp html banner|**| -->

<br>



   
     
 
        <!-- |**|begin egp html banner|**| -->
        <div id="ygrp-vital" style="background-color: #f2f2f2; font-family: Verdana; font-size: 10px; margin-bottom: 10px; padding: 10px;">

        <span id="vithd" style="font-weight: bold; color: #333; text-transform: uppercase; "><a href="https://groups.yahoo.com/neo/groups/domaindrivendesign/info;_ylc=X3oDMTJlNWdsNjM2BF9TAzk3MzU5NzE0BGdycElkAzgxMTY5MjMEZ3Jwc3BJZAMxNzA1MDA3MTgxBHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTQ2NjYyNDU2NQ--" style="text-decoration: none;">Visit Your Group</a></span>

     <ul style="list-style-type: none; margin: 0; padding: 0; display: inline;">
            <li style="border-right: 1px solid #000; font-weight: 700; display: inline; padding: 0 5px; margin-left: 0;">
      <span class="cat"><a href="https://groups.yahoo.com/neo/groups/domaindrivendesign/members/all;_ylc=X3oDMTJmNzJhaGxoBF9TAzk3MzU5NzE0BGdycElkAzgxMTY5MjMEZ3Jwc3BJZAMxNzA1MDA3MTgxBHNlYwN2dGwEc2xrA3ZtYnJzBHN0aW1lAzE0NjY2MjQ1NjU-" style="text-decoration: none;">New Members</a></span>
      <span class="ct" style="color: #ff7900;">1</span>
    </li>
                                              </ul>
  </div>


<div id="ft" style="font-family: Arial; font-size: 11px; margin-top: 5px; padding: 0 2px 0 0; clear: both;">
  <a href="https://groups.yahoo.com/neo;_ylc=X3oDMTJkNnNqb2VjBF9TAzk3NDc2NTkwBGdycElkAzgxMTY5MjMEZ3Jwc3BJZAMxNzA1MDA3MTgxBHNlYwNmdHIEc2xrA2dmcARzdGltZQMxNDY2NjI0NTY1" style="float: left;"><img src="http://l.yimg.com/ru/static/images/yg/img/email/new_logo/logo-groups-137x15.png" height="15" width="137" alt="Yahoo! Groups" style="border: 0;"/></a>
  <div style="color: #747575; float: right;"> &bull; <a href="https://info.yahoo.com/privacy/us/yahoo/groups/details.html" style="text-decoration: none;">Privacy</a> &bull; <a href="mailto:[email protected]?subject=Unsubscribe" style="text-decoration: none;">Unsubscribe</a> &bull; <a href="https://info.yahoo.com/legal/us/yahoo/utos/terms/" style="text-decoration: none;">Terms of Use</a> </div>
</div>

<!-- |**|end egp html banner|**| -->

  </div> <!-- ygrp-msg -->

   


  <br>

<!-- |**|end egp html banner|**| -->


<div style="color: white; clear: both;"/>__,_._,___</div>
</body>

</html>

--9nlWnTS9ocNmxdhsK3FKVLWiM6a5jwOaA8HvrLV--