| Newsgroups |
gmane.comp.programming.domain-driven-design |
| Message-ID |
<[email protected]> |
--9nlWnTS9ocNmxdhsK3FKVLWiM6a5jwOaA8HvrLV
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset="UTF-8"
V2UgY3VycmVudGx5IGhhdmUgYSBtb2RlbCB3aGVyZSBhIHNpbmdsZSBhZ2dyZWdhdGUgbW9kZWxz
IGEgUGVyc29uIChpZGVudGlmaWNhdGlvbiwgYWRkcmVzcywgZXRjKSBhbmQgaGlzL2hlciBwZXJz
b25hbCByZWxhdGlvbnNoaXBzIChtYXJyaWFnZSwgcGFydG5lcnNoaXAsIGRpdm9yY2VzLCBldGMu
KS4gVGhpcyBhZ2dyZWdhdGUgaXMgZmFpcmx5IGxhcmdlIGFuZCBub3QgYWxsIHVzZSBjYXNlcyBp
bnRlcmVzdGVkIGluIHRoZSByZWxhdGlvbnMgd2hlcmUgb3BlcmF0aW5nIG9uIHRoZSBQZXJzb24g
YWdncmVnYXRlLCB3ZSBhcmUgbG9va2luZyBhdCB0aGUgY29uc2VxdWVuY2VzIG9mIHNwbGl0dGlu
ZyB0aGlzIGluIHR3byBhZ2dyZWdhdGVzIChQZXJzb24gYW5kIFBlcnNvblJlbGF0aW9uIGZvciBp
bnN0YW5jZSkuDQoNCkFzIGEgY29uc2VxdWVuY2UsIHRoZXJlIGlzIG5vIHBvc3NpYmlsaXR5IHRv
IGltcGxlbWVudCBzb21ldGhpbmcgbGlrZSBQZXJzb24ubWFycmllc1RvKFBlcnNvbi5JZCBhbm90
aGVyUGVyc29uKS4gVGhlIHJlYXNvbiBpcyB0aGUgY29uc3RyYWludCB0aGF0IHRoaXMgaXMgb25s
eSBhbGxvd2VkIGFzIGxvbmcgYXMgdGhpcyByZWxhdGlvbiBpcyBub3QgYWxyZWFkeSBwcmVzZW50
IGF0IHRoZSBnaXZlbiBtb21lbnQgKEEgUGVyc29uIGNhbm5vdCBiZSBtYXJyaWVkIHR3aWNlIGF0
IHRoZSBzYW1lIHRp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BjYXNlIGNyZWF0aW5nIGR1cGxpY2F0ZSByZWxhdGlvbnNoaXBzIGNhbm5v
dCBiZSBwcmV2ZW50ZWQgYnkgdGhlIGRvbWFpbiB3aGVuIHVzaW5nIHRoaXMgb3B0aW9uLg0KKiBJ
bmplY3QgdGhlIFJlbGF0aW9uIHJlcG9zaXRvcnkgaW50byBQZXJzb24sIHNvIGV4aXN0aW5nIFJl
bGF0aW9uIGluc3RhbmNlcyBjYW4gYmUgcmVxdWVzdGVkIGFzIHBhcnQgb2YgdGhlIGltcGxlbWVu
dGF0aW9uLiBBcyBJIHVuZGVyc3Rvb2QsIHRoaXMgaXMgYmFkIHByYWN0aWNlIGFzIHdlbGwuDQoN
CkFzIHRoaXMgc2VlbXMgYSByYXRoZXIgZ2VuZXJhbCBwcm9ibGVtLCBJIGFtIGN1cmlvdXMgb24g
aG93IHlvdSBndXlzIHdvdWxkIG1vZGVsIHRoaXMuDQogDQoNCg==
--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|**| -->
We currently have a model where a single aggregate models a Person (identification, address, etc) and his/her personal relationships (marriage, partnership, divorces, etc.). This aggregate is fairly large and not all use cases interested in the relations where operating on the Person aggregate, we are looking at the consequences of splitting this in two aggregates (Person and PersonRelation for instance).<br><br>As a consequence, there is no possibility to implement something like Person.marriesTo(Person.Id anotherPerson). The reason is the constraint that this is only allowed as long as this relation is not already present at the given moment (A Person cannot be married twice at the same time). This is just an example but there a number of constraints on the model with respect to a Person
and his relationships.<br><br>We have identified the following options on how to implement this but are not satisfied with any of them:<br>* Create a domain service. This feels unnatural as the behaviour is not part of the Person that is marrying.<br>* Implement the behaviour on Person and provide a list of current relationships, e.g. Person.marriesTo(PersonId anotherPerson, List<Relation> currentRelations). This enables the Person to implement the required behaviour, but also requires some state (a set of aggregates) to be injected.<br>* Leave the orchestration to the use case implementing the behaviour. This also seems wrong, as the domain should be responsible for maintaining its integrity. A use case creating duplicate relationships cannot be prevented by the domain when using
this option.<br>* Inject the Relation repository into Person, so existing Relation instances can be requested as part of the implementation. As I understood, this is bad practice as well.<br><br>As this seems a rather general problem, I am curious on how you guys would model this.<br><p><span><br class="yui-cursor"></span></p>
<!-- |**|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=24773/stime=1466541372" 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=X3oDMTJlazdxNHRuBF9TAzk3MzU5NzE0BGdycElkAzgxMTY5MjMEZ3Jwc3BJZAMxNzA1MDA3MTgxBHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTQ2NjU0MTM3Mg--" 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=X3oDMTJmNzM2bW9pBF9TAzk3MzU5NzE0BGdycElkAzgxMTY5MjMEZ3Jwc3BJZAMxNzA1MDA3MTgxBHNlYwN2dGwEc2xrA3ZtYnJzBHN0aW1lAzE0NjY1NDEzNzI-" 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=X3oDMTJkYzFtOXBuBF9TAzk3NDc2NTkwBGdycElkAzgxMTY5MjMEZ3Jwc3BJZAMxNzA1MDA3MTgxBHNlYwNmdHIEc2xrA2dmcARzdGltZQMxNDY2NTQxMzcy" 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;"> • <a href="https://info.yahoo.com/privacy/us/yahoo/groups/details.html" style="text-decoration: none;">Privacy</a> • <a href="mailto:[email protected]?subject=Unsubscribe" style="text-decoration: none;">Unsubscribe</a> • <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--