Content deleted Content added
Narky Blert (talk | contribs) Link to DAB page repaired |
No edit summary |
||
Line 314:
<source lang="csharp">
var InvoiceCollection = Service.GetInvoices();
foreach (Invoice
}
//
public void SendToCollectionIfNecessary()
{
{
▲ if (!ShouldSendToCollection) return;
}
}
public bool ShouldSendToCollection()
{
return currentInvoice.OverDue
&& currentInvoice.NoticeSent
&& !currentInvoice.InCollection;
}
</source>This alternative uses foundation concepts of Get-Only Properties, Condition-Logic, and Functions. The key alternative here is Get-Only Properties, which are well-named to maintain the Domain-Driven language, and enable the continued use of the natural && operator, instead of the Specification Pattern's And() function. Furthermore, the creation of a well-named function SendToCollectionIfNecessary is potentially more useful and descriptive, than the previous example (which could also be contained in such a function, except not directly on the object apparently).
|