I'm working on assignment Utility International. There is a composition relationship between gas bill and gas units in the domain model. The domain model shows gas bill is a part of gas units, which I think the relationship should be opposite, gas units is a part of gas bill.
Can I assume that this relationship is incorrect in the domain model? Does anybody have same concern as me?
I hope this post does not violate Oracle rules, if so, please remove it
Joined: Jan 12, 2013
I just started working on the very same assignment and to me, the given domain model does not make sense at that point, either.
The only explanation I have is:
"Gas Units result in a Gas Bill" so that if there are no gas units (i.e. the customer hasn't booked a "gas package"), there will be no gas bill.
Secondly, I modelled the Monthly Bill to be abstract, so there will be separated bills for gas, water and electricity. But the use case "Calculate Bill" describes that for each user, a total bill is generated.
I'm a little confused here, too.
P.S.: I know it is possible to change the domain model but maybe I just don't get the intention of it.
Joined: Jan 12, 2013
The more I think about the domain model, the more I have troubles understanding it. It seems to me that it doesn't match the textual descriptions.
1) I modelled the Monthly Bill to be abstract, so there will be separate bills for gas, water and electricity. But the use case "Calculate Bill" describes that for each user, a total bill is generated. If I model it as a concrete class, the generalization from GasBill, WaterBill and ElectricityBill to MonthlyBill doesn't make sense anymore. Instead I would add a TotalBill with associations to each of the bill types.
2) Does the external billing module have access to my persistence layer? It's said to communicate via web service but the use case calculate bill states it's called by an external call (web service) and "retrieves" the required information to calculate the total bill per user.
3) How does the "Customer Usage" relate to the customer as long as the bill does not exist?
4) Shouldn't the User class be an @Entity bean? Cades working solution is missing that.