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.

In the object world which method is best for milking a cow?

best Cow method milking object world
0
10 Posted

In the object world which method is best for milking a cow?

0

Index In the real world, the farmer milks a milking cow. In the object world, the milking cow offers up a milk method that creates a transaction recording how much milk was delivered to the farmer. There are two possibilities for the milk method in the MilkingCow class: public MilkingTransaction milk(long millilitersRequested){ … } or public MilkingTransaction milk(long millilitersRequested, Farmer aFarmer){ … } The second choice is what we prefer. The cow’s milk service creates the transaction because an old cow may have not be able to crank out milliliters requested. So the cow knows its limits of production and can validate milliliters requested better than the farmer. If the milliliters requested is too much then an exception can be thrown. The farmer is also a parameter because the transaction should not be created if the farmer does not have the proper privileges to milk the cow. In our methodology we localize all the testing rules in the services involved in adding collabora

Related Questions

What is your question?

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