What do you think about that diagram?

2019-07-17 19:11发布

Could you please tell me if my diagram is correct? I especially care about relations between PaymentService and Customer, Payment, Customer

I guess that:

   class Customer {
     private List<Payment> payments;
     //..
     public boolean pay() {
       return PaymentService.pay(this.payments);
       // calling the static method of the class PaymentService
     }
   }

   interface Payment {
     // knows nothing about Customer
   }

   class PaymentService {
     public static boolean pay (List<ayment> payments) {
       // the magic here is return result
     }
   }


UPD: Now, I noticed that why I use static member, but it does not touch my question.

What is the common way to construct payment systems (It looks like a general task)?


I guess that the FFCustomer should have only one account. And an account exists only while an FFCustomer exists.

enter image description here

UPD: enter image description here

1条回答
Melony?
2楼-- · 2019-07-17 20:12

It's pretty close. Make the association to Payment unidirectional. Make the account property an association end. In general, attributes should only be typed by datatypes, not classes. You are also missing an operation in the Payment interface.

查看更多
登录 后发表回答