Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Why don the doAdd & doRemove methods test business rules?

Business doAdd methods rules Test
0
10 Posted

Why don the doAdd & doRemove methods test business rules?

0

Index The rationale about the add, testAdd, and doAdd methods is explained in-depth in the book on pp. 241 –245, and in our article Putting Business Rules into Business Objects. In a nutshell, we don’t put the tests in the doAdds and doRemoves because we want the flexibility of bypassing rules in special cases—when restoring an object from persistent storage, or for special trusted business services. The reason for having the doAdds is the encapsulate the implementation of the assignment in case other things need to happen when the object changes state, in case the assignment implementation changes, in case specializations want to change the assignment implementation, etc.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123