你觉得那个图表怎么样?
What do you think about that diagram?
你能告诉我我的图表是否正确吗?
我特别关心 PaymentService
和 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:现在,我注意到为什么我使用静态成员,但这并没有触及我的问题。
构建支付系统的常用方法是什么(看起来很一般)?
我想 FFFCustomer 应该只有一个帐户。
并且只有当 FFFCustomer 存在时才会存在一个帐户。
更新:
非常接近。使与付款的关联是单向的。使帐户 属性 成为关联端。一般来说,属性应该只按数据类型分类,而不是 类。您还缺少 Payment 接口中的操作。
你能告诉我我的图表是否正确吗?
我特别关心 PaymentService
和 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:现在,我注意到为什么我使用静态成员,但这并没有触及我的问题。
构建支付系统的常用方法是什么(看起来很一般)?
我想 FFFCustomer 应该只有一个帐户。 并且只有当 FFFCustomer 存在时才会存在一个帐户。
更新:
非常接近。使与付款的关联是单向的。使帐户 属性 成为关联端。一般来说,属性应该只按数据类型分类,而不是 类。您还缺少 Payment 接口中的操作。