What is the common way to represent this kind of diagram?

前端 未结 1 1831
悲哀的现实
悲哀的现实 2020-12-22 05:22

I need to represent the payment of a customer to buy a flight ticket in an airport. The system of airport has a bonus system.

So customer can make payment for ticke

相关标签:
1条回答
  • 2020-12-22 05:56

    You should start with a model of the problem domain. I would expect something like the following:

    This diagram states that:

    • A Customer offers one or more Payments to a Payment Service
    • A Payment Service accepts one or more Payments offered by a Customer
    • Each Payment has an amount
    • A Payment must be a Mileage Payment, Cash Payment, or Credit Card Payment
    • There is no overlap among the types of Payments

    To then answer your question in terms of the solution domain, I would have your pay() method accept a collection of payments. You don't need subordinate interfaces for each kind of Payment, only various class implementations. I would use polymorphic operations to debit (if that's the right word), roll back if anything fails, and commit when all the debits succeed.

    0 讨论(0)
提交回复
热议问题