你想想图什么? [英] What do you think about that diagram?

查看:152
本文介绍了你想想图什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你能告诉我,如果我的图是正确的?
我特别关心 PaymentService 之间的关系和客户
付款客户

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

我猜是:

   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:现在,我注意到,我为什么用静态成员,但它并没有触及我的问题


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

什么是构建的支付系统(它看起来像一个普通的任务)的常见方式?



我猜测,FFCustomer应该只有一个帐户。
虽然一个FFCustomer存在的帐户才存在。

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:

推荐答案

这是pretty接近。使协会付款单向的。使帐户属性的关联端。一般情况下,属性只能由数据类型,而不是类类型。您还缺少在付款界面的操作。

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.

这篇关于你想想图什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆