你能帮我理解接下来的事情吗?所以,我读了 R.Martin 的 Clean Architecture 并且有很多方案。
图片1:
我的实施:
Billing.java
public class Billing {
public Billing(){
//creating of licenses
License personalLicense = new PersonalLicense();
License businessLicense = new BusinessLicense();
//method using
personalLicense.calcFee();
businessLicense.calcFee();
}
}
License.java
public interface License {
public void calcFee();
}
PersonalLicense.java
public class PersonalLicense implements License {
public PersonalLicense(){
//constructor implementation here
}
@Override
public void calcFee(){
//method implementation here
}
}
BusinessLicense.java
public class BusinessLicense implements License {
//private ? users - Unknown type just for example
@Override
public BusinessLicense(){
//constructor implementation here
}
public void calcFee(){
//method implementation here
}
}
图二:
我的实施:
U1Ops.java
public interface U1Ops{
public void op1();
}
U2Ops.java
public interface U2Ops{
public void op2();
}
U3Ops.java
public interface U3Ops{
public void op3();
}
OPS.java
public class OPS implements U1Ops, U2Ops, U3Ops{
public OPS(){ ... }
@Override
public void op1() { ... }
@Override
public void op2() { ... }
@Override
public void op3() { ... }
}
User1.java
public class User1 {
public User1(){
OPS u1Ops = new U1Ops();
u1Ops.op1();
}
}
User2.java
public class User2 {
public User2(){
OPS u2Ops = new U2Ops();
u2Ops.op2();
}
}
User3.java
public class User3 {
public User3(){
OPS u3Ops = new U3Ops();
u3Ops.op3();
}
}
图三:
我的实施:
Permissions.java
public class Permissions{
public Permissions() { ... }
public classMethod() { ... }
}
User1.java
public class User1 {
public User1(){
Permissions p = new Permissions();
p.classMethod();
}
}
千万里不及你
相关分类