What do you think about that diagram?

不问归期 提交于 2019-12-12 20:18:55

问题


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.

UPD:


回答1:


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.



来源:https://stackoverflow.com/questions/34280751/what-do-you-think-about-that-diagram

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!