| Newsgroups |
gmane.comp.programming.domain-driven-design |
| Message-ID |
<[email protected]> |
--9nlWnTS9ocNmxdhsK3FKVLWiM6a5jwOaA8HvrLV
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset="UTF-8"
R3JlZXRpbmdzLA0KIA0KDQogSSBoYXZlIG1vZGVsZWQgYSBzaW1wbGUgU29jaWFsIE5ldHdvcmss
IGJ1dCBJIGFtIHJ1bm5pbmcgaW50byBhIGJpdCBvZiBhbiBpbXBsZW1lbnRhdGlvbiBjb251bmRy
dW0sIHdoZW4gaXQgY29tZXMgdG8gZmlndXJpbmcgb3V0IHRoZSBiZXN0IHdheSB0byBkZWxldGUg
YSBzcGVjaWZpYyBFbnRpdHkgZnJvbSB3aXRoaW4gYW4gQWdncmVnYXRlLiAgSSB3YXMgaG9waW5n
IHRoYXQgSSBtaWdodCBiZSBhYmxlIHRvIGZpbmQgc29tZSBndWlkYW5jZS4NCiANCg0KIFNpbmNl
IG15IG1vZGVsIGlzIGEgZmFpcmx5IG9idmlvdXMgb25lLCBJIGNhbiBqdW1wIHJpZ2h0IGludG8g
bXkgaXNzdWUuICBXaGF0IEkgaGF2ZSBpcyBhIFBvc3QgQWdncmVnYXRlIHRoYXQgY2FuIGNvbnRh
aW4gbXVsdGlwbGUgQ29tbWVudCBFbnRpdGllcy4gIEEgd2VsbC10cmFmZmlja2VkIFBvc3QgY2Fu
IGNvbnRhaW4gaHVuZHJlZCwgb3IgZXZlbiB0aG91c2FuZHMsIG9mIENvbW1lbnRzLiAgUGFydCBv
ZiB0aGUgYnVzaW5lc3MgcmVxdWlyZW1lbnRzIGlzIHRoYXQgYSBVc2VyIGNhbiByZW1vdmUgaGlz
L2hlciBDb21tZW50IGZyb20gYSBQb3N0LiAgVGhlIHNjZW5hcmlvIGFsc28gaG9sZHMgdHJ1ZSBm
b3IgZWRpdHMgdG8gYSBDb21tZW50LCBzbyBJIGltYWdpbmUgdGhhdCBJIGFtIGZhY2luZyB0aGUg
c2FtZSBpc3N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
dGhvZCwgd2hpY2ggbWVhbnMgdGhhdCBJIGluY3VyIGEgbG9hZCBvcGVyYXRpb24gYmVmb3JlIEkg
Y2FuIHJlbW92ZS4gIElmIEkgaGF2ZSBodW5kcmVkcywgb3IgdGhvdXNhbmRzLCBvZiBDb21tZW50
cyBvbiBhIFBvc3QsIGl0IHNlZW1zIGV4Y2Vzc2l2ZSB0byB3YW50IHRvIGxvYWQgdGhlbSBhbGwg
dG8ganVzdCBkZWxldGUgb25lLiAgSSBzdXBwb3NlIHRoYXQgSSBjYW4gaGF2ZSB0aGUgQWdncmVn
YXRlIFJvb3Qgbm90IGxvYWQgQ29tbWVudHMgYXMgcGFydCBvZiB0aGUgaW5pdGlhbCBHZXQoKSBv
cGVyYXRpb24sIGFuZCBleHBvc2UgYSBMb2FkQ29tbWVudHMoKSBtZXRob2Qgb24gdGhlIEFnZ3Jl
Z2F0ZSBSb290LiAgSSB3aWxsIGxpa2VseSBuZWVkIHRvIGRvIHNvbWV0aGluZyBsaWtlIHRoYXQs
IGFueWhvdywgYmVjYXVzZSBJIHdvdWxkIG5vdCB3YW50IHRvIGJlIGluY3VycmluZyB0aGUgcGVy
Zm9ybWFuY2UgcGVuYWx0eSBmb3IgbG9hZGluZyBhbmQgdHJhbnNmZXJyaW5nIGV2ZXJ5IENvbW1l
bnQgd2hlbiBzb21lb25lIGZpcnN0IHZpZXdzIGEgUG9zdC4NCiANCg0KIElmIEkgY291bGQgZ2V0
IHNvbWUgZmVlZGJhY2sgYXMgdG8gaWYgdGhpcyBpcyBhIHNhbmUgYXBwcm9hY2gsIGl0IHdvdWxk
IGJlIG1vc3QgYXBwcmVjaWF0ZWQuDQogDQoNCiBUaGFua3MhDQogDQoNCiBKb3NlcGgNCg==
--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|**| -->
<p><span>Greetings,</span></p><p><span><br></span></p><p><span>I have modeled a simple Social Network, but I am running into a bit of an implementation conundrum, when it comes to figuring out the best way to delete a specific Entity from within an Aggregate. I was hoping that I might be able to find some guidance.</span></p><p><span><br></span></p><p><span>Since my model is a fairly obvious one, I can jump right into my issue. What I have is a Post Aggregate that can contain multiple Comment Entities. A well-trafficked Post can contain hundred, or even thousands, of Comments. Part of the business requirements is that a User can remove his/her Comment from a Post. The scenario also holds true for edits to a Comment, so I imagine that I am facing the same issue
with each. What that issue is, would be what is the best implementation route for removing a single Comment on a Post, considering the potentially large number of Comments that can exist?</span></p><p><span><br></span></p><p><span>The potential solution that I see would be:</span></p><p><ul><li>A RemoveComment command is used by an Application Service, containing the identifier of the Post that Comment belongs to, as well as the identifier of the Comment, itself.</li><li>The Command Handler will invoke the RemoveComment() method on the Post Entity.</li><li>The RemoveComment() method will raise a CommentRemoved Event.</li><li>The Event Handler will invoke a Domain Service to handle the CRUD-y operation.</li></ul><div>On the surface, at least, I feel that this makes sense. My
issue with it, though, is that I would need to load the Post to invoke the RemoveComment() method, which means that I incur a load operation before I can remove. If I have hundreds, or thousands, of Comments on a Post, it seems excessive to want to load them all to just delete one. I suppose that I can have the Aggregate Root not load Comments as part of the initial Get() operation, and expose a LoadComments() method on the Aggregate Root. I will likely need to do something like that, anyhow, because I would not want to be incurring the performance penalty for loading and transferring every Comment when someone first views a Post.</div><div><br></div><div>If I could get some feedback as to if this is a sane approach, it would be most appreciated.</div><div><br></div><di
v>Thanks!</div><div><br></div><div>Joseph</div>
<!-- |**|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=24805/stime=1472838773" 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=X3oDMTJlN2FhZzNnBF9TAzk3MzU5NzE0BGdycElkAzgxMTY5MjMEZ3Jwc3BJZAMxNzA1MDA3MTgxBHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTQ3MjgzODc3Mw--" 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=X3oDMTJmYTEycmhtBF9TAzk3MzU5NzE0BGdycElkAzgxMTY5MjMEZ3Jwc3BJZAMxNzA1MDA3MTgxBHNlYwN2dGwEc2xrA3ZtYnJzBHN0aW1lAzE0NzI4Mzg3NzM-" style="text-decoration: none;">New Members</a></span>
<span class="ct" style="color: #ff7900;">4</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=X3oDMTJkaTIyMGhoBF9TAzk3NDc2NTkwBGdycElkAzgxMTY5MjMEZ3Jwc3BJZAMxNzA1MDA3MTgxBHNlYwNmdHIEc2xrA2dmcARzdGltZQMxNDcyODM4Nzcz" 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--