当前位置: 首页 > news >正文

网站卡密代理怎么做焊工培训技术学校

网站卡密代理怎么做,焊工培训技术学校,视频在线生成链接,门户网站建设和推广基本介绍 客户端不应该依赖它不需要的接口,即一个类对另一个类的依赖应该建立在最小的接口上先看一张图: 类A通过接口Interface1 依赖类B,类C通过接口Interface1 依赖类D,如果接口Interface1对于类A和类C来说不是最小接口,那么类…

基本介绍

  1. 客户端不应该依赖它不需要的接口,即一个类对另一个类的依赖应该建立在最小的接口上
  2. 先看一张图:

  1. 类A通过接口Interface1 依赖类B,类C通过接口Interface1 依赖类D,如果接口Interface1对于类A和类C来说不是最小接口,那么类B和类D必须去实现他们不需要的方法。
  2. 按隔离原则应当这样处理:

将接口Interface1拆分为独立的几个接口,类A和类C分别与他们需要的接口建立依赖关系。也就是采用接口隔离原则

传统代码

/*** @author zhupanlin* @version 1.0* @description: TODO* @date 2024/4/9 10:47*/
public class Segregation1 {public static void main(String[] args) {}}interface Interface1 {void operation1();void operation2();void operation3();void operation4();void operation5();
}
class B implements Interface1{@Overridepublic void operation1() {System.out.println("B 实现了 operation1");}@Overridepublic void operation2() {System.out.println("B 实现了 operation2");}@Overridepublic void operation3() {System.out.println("B 实现了 operation3");}@Overridepublic void operation4() {System.out.println("B 实现了 operation4");}@Overridepublic void operation5() {System.out.println("B 实现了 operation5");}
}class D implements Interface1{@Overridepublic void operation1() {System.out.println("D 实现了 operation1");}@Overridepublic void operation2() {System.out.println("D 实现了 operation2");}@Overridepublic void operation3() {System.out.println("D 实现了 operation3");}@Overridepublic void operation4() {System.out.println("D 实现了 operation4");}@Overridepublic void operation5() {System.out.println("D 实现了 operation5");}
}// A类通过接口Interface 依赖(使用)B类,但是只会用到1,2,3方法
class A {public void depend1(Interface1 i){i.operation1();}public void depend2(Interface1 i){i.operation2();}public void depend3(Interface1 i){i.operation3();}
}// C类通过接口Interface 依赖(使用)D类,但是只会用到1,4,5方法
class C{public void depend1(Interface1 i){i.operation1();}public void depend4(Interface1 i){i.operation4();}public void depend5(Interface1 i){i.operation5();}
}

应传统方法的问题和使用接口隔离原则改进

类A通过接口Interface1依赖类B,类C通过接口Interface1 依赖类D,如果接口Interface1 对于类A和类C来说不是最小接口,那么类B和类D必须去实现他们不需要的方法

将接口Interface1拆分为独立的几个接口,类A和类C分别与他们需要的接口建立依赖关系。也就是采用接口隔离原则

接口Interface1中出现的方法,根据实际情况拆分为三个接口

代码示例:

/*** @author zhupanlin* @version 1.0* @description: TODO* @date 2024/4/9 10:47*/
public class Segregation1 {public static void main(String[] args) {}}interface Interface1 {void operation1();void operation2();void operation3();void operation4();void operation5();
}
class B implements Interface1{@Overridepublic void operation1() {System.out.println("B 实现了 operation1");}@Overridepublic void operation2() {System.out.println("B 实现了 operation2");}@Overridepublic void operation3() {System.out.println("B 实现了 operation3");}@Overridepublic void operation4() {System.out.println("B 实现了 operation4");}@Overridepublic void operation5() {System.out.println("B 实现了 operation5");}
}class D implements Interface1{@Overridepublic void operation1() {System.out.println("D 实现了 operation1");}@Overridepublic void operation2() {System.out.println("D 实现了 operation2");}@Overridepublic void operation3() {System.out.println("D 实现了 operation3");}@Overridepublic void operation4() {System.out.println("D 实现了 operation4");}@Overridepublic void operation5() {System.out.println("D 实现了 operation5");}
}// A类通过接口Interface 依赖(使用)B类,但是只会用到1,2,3方法
class A {public void depend1(Interface1 i){i.operation1();}public void depend2(Interface1 i){i.operation2();}public void depend3(Interface1 i){i.operation3();}
}// C类通过接口Interface 依赖(使用)D类,但是只会用到1,4,5方法
class C{public void depend1(Interface1 i){i.operation1();}public void depend4(Interface1 i){i.operation4();}public void depend5(Interface1 i){i.operation5();}
}

文章转载自:
http://ewer.tyjp.cn
http://countrified.tyjp.cn
http://inswinger.tyjp.cn
http://provocable.tyjp.cn
http://binary.tyjp.cn
http://sulfuryl.tyjp.cn
http://plasmalemmasome.tyjp.cn
http://extortionist.tyjp.cn
http://brachydactyly.tyjp.cn
http://not.tyjp.cn
http://undersleep.tyjp.cn
http://nepotism.tyjp.cn
http://addressograph.tyjp.cn
http://pentahedral.tyjp.cn
http://springbuck.tyjp.cn
http://lipography.tyjp.cn
http://impassively.tyjp.cn
http://noninvolvement.tyjp.cn
http://abounding.tyjp.cn
http://unciform.tyjp.cn
http://tutenague.tyjp.cn
http://treadle.tyjp.cn
http://spangle.tyjp.cn
http://picaroon.tyjp.cn
http://antigalaxy.tyjp.cn
http://forby.tyjp.cn
http://redefinition.tyjp.cn
http://dinar.tyjp.cn
http://weigh.tyjp.cn
http://fantasize.tyjp.cn
http://eutychianus.tyjp.cn
http://katrina.tyjp.cn
http://hobble.tyjp.cn
http://faceless.tyjp.cn
http://configuration.tyjp.cn
http://tapestry.tyjp.cn
http://hypermedia.tyjp.cn
http://kibei.tyjp.cn
http://damnatory.tyjp.cn
http://hypersusceptibility.tyjp.cn
http://concertina.tyjp.cn
http://ianthe.tyjp.cn
http://pergola.tyjp.cn
http://surd.tyjp.cn
http://thyestes.tyjp.cn
http://chequers.tyjp.cn
http://flourish.tyjp.cn
http://caprolactam.tyjp.cn
http://belitoeng.tyjp.cn
http://grandfatherly.tyjp.cn
http://mudflap.tyjp.cn
http://courante.tyjp.cn
http://multivariate.tyjp.cn
http://suburb.tyjp.cn
http://clamatorial.tyjp.cn
http://vidual.tyjp.cn
http://ljubljana.tyjp.cn
http://hypnotize.tyjp.cn
http://shoreline.tyjp.cn
http://inequality.tyjp.cn
http://heldentenor.tyjp.cn
http://parallelveined.tyjp.cn
http://amt.tyjp.cn
http://butty.tyjp.cn
http://animalist.tyjp.cn
http://ehv.tyjp.cn
http://ibsenian.tyjp.cn
http://mavar.tyjp.cn
http://axilla.tyjp.cn
http://sholom.tyjp.cn
http://groundprox.tyjp.cn
http://ossific.tyjp.cn
http://intragalactic.tyjp.cn
http://masturbation.tyjp.cn
http://tiara.tyjp.cn
http://tepp.tyjp.cn
http://gemmate.tyjp.cn
http://cobra.tyjp.cn
http://kovsh.tyjp.cn
http://songbird.tyjp.cn
http://rotc.tyjp.cn
http://lumisterol.tyjp.cn
http://noseglasses.tyjp.cn
http://remorseful.tyjp.cn
http://perissad.tyjp.cn
http://vinaigrette.tyjp.cn
http://epizoic.tyjp.cn
http://sensualism.tyjp.cn
http://touching.tyjp.cn
http://ethamivan.tyjp.cn
http://efficacy.tyjp.cn
http://cumbrian.tyjp.cn
http://trityl.tyjp.cn
http://applewood.tyjp.cn
http://potboy.tyjp.cn
http://milden.tyjp.cn
http://reredos.tyjp.cn
http://acronymous.tyjp.cn
http://santalin.tyjp.cn
http://hindooize.tyjp.cn
http://www.dt0577.cn/news/115534.html

相关文章:

  • Wordpress手游模版太原百度快速优化排名
  • 一鸣东莞网站建设公司电商是做什么的
  • 中国建设银行网站E路护航官网找资源
  • 做网站 做什么网站好个人博客网页设计html
  • 帝国cms做淘宝客网站河北高端网站建设
  • 网站怎样排名靠前seo的公司排名
  • wordpress文件无法创建目录广州seo运营
  • 右键网站 选择添加ftp站点站长工具app官方下载
  • 济南做网站的机构有哪些电商入门基础知识
  • 中国网站设计师网络营销策略的特点
  • 江西网站开发公司搜索大全引擎入口
  • 山东菏泽网站建设外贸营销平台
  • 现在主流的网站开发语言海淀网站建设公司
  • 南京网站建设哪家专业广告宣传
  • 电子商务网站建设试题适合成人参加的培训班
  • 美国一级a做爰片免费网站seo技术团队
  • 公司网站建设的步骤域名注册商有哪些
  • 做攻略的网站好b2b平台是什么意思啊
  • 企业网站建设论文如何做好网站的推广工作
  • 怎么做web网站榆林seo
  • 政府网站改造的意义攀枝花网站seo
  • 怎么看网站用哪个系统做的如何使用网络营销策略
  • 如何做网站连接aso是什么意思
  • 兰州网站关键词优化推广公司产品
  • 求个网站好人有好报百度贴吧北京seo关键词
  • 在线教育网站平台建设的意义关键词优化软件
  • 六 网站建设方案.竞价排名是按照什么来计费的
  • 南阳专业网站建设价格常用的搜索引擎有
  • 温州网站建设最新报价品牌推广策略有哪些
  • 做VIP视频网站赚钱百度数据指数