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

辽宁住房和城乡建设厅网站图片做多的网站是哪个

辽宁住房和城乡建设厅网站,图片做多的网站是哪个,建设开发网站,全网营销型的网站文章目录 一、工厂模式#xff08;三种#xff09;1.简单工厂模式1.1 概念#xff1a;1.2 使用场景#xff1a;1.3 模型图解#xff1a;1.4 伪代码#xff1a; 2.工厂方法模式2.1 概念#xff1a;2.2 使用场景#xff1a;2.3 模型图解#xff1a;2.4 伪代码 3.抽象工厂… 文章目录 一、工厂模式三种1.简单工厂模式1.1 概念1.2 使用场景1.3 模型图解1.4 伪代码 2.工厂方法模式2.1 概念2.2 使用场景2.3 模型图解2.4 伪代码 3.抽象工厂模式3.1 概念3.2 使用场景3.3 模型图解3.4 伪代码3.5 实战抽象工厂策略模式3.5.1 业务方法调用3.5.2 抽象工厂创建二级工厂定义获取业务对象接口二级工厂去创建具体的业务对象3.5.3 二级工厂 获得对象3.5.3 二级工厂 具体的业务对象3.5.3 处理的业务 补充6大设计原则3.6 总结 一、工厂模式三种 1.简单工厂模式 1.1 概念 通过一个工厂类来创建对象根据不同的参数或条件返回相应的对象实例。 隐藏了对象的创建细节客户端只需通过工厂类获取对象而不需要直接实例化对象。 1.2 使用场景 使用者根据不同的参数或条件返回相应的对象实例 1.3 模型图解 角色手机总工厂、参数、手机、小米手机、华为手机 后续补充 1.4 伪代码 public class SimpleFactoryTest {static class SimpleFactory {static SimpleFactoryTest.Mobile createMobile(int mobileType) throws Exception {if (mobileType 1) {return new SimpleFactoryTest.HuaWei();} else if (mobileType 2) {return new SimpleFactoryTest.XiaoMi();} else {throw new Exception(手机类型不存在);}}}public static class Mobile {protected void call() {System.out.println(mobile...);}}public static class HuaWei extends Mobile {public void call() {System.out.println(huaWei...);}}public static class XiaoMi extends Mobile {public void call() {System.out.println(xiaomi...);}}public static void main(String[] args) throws Exception {SimpleFactoryTest.Mobile mobile SimpleFactory.createMobile(1);mobile.call();} }2.工厂方法模式 2.1 概念 定义了一个创建对象的接口具体对象的创建由对象工厂决定。 使得对象的创建延迟到子类工厂从而实现了对扩展开放、对修改关闭的原则。 2.2 使用场景 使用者根据不同的子工厂创建相应的对象实例 2.3 模型图解 角色手机总工厂、小米手机工厂、华为手机工厂、手机、小米手机、华为手机 后续补充 2.4 伪代码 public class FactoryMethodTest {interface FactoryMethod {Mobile createMobile();}static class HuaweiFactory implements FactoryMethod {Overridepublic Mobile createMobile() {return new Huawei();}}static class XiaomiFactory implements FactoryMethod {Overridepublic Mobile createMobile() {return new Xiaomi();}}static class Mobile {protected void call() {System.out.println(mobile...);}}static class Huawei extends Mobile {Overridepublic void call() {System.out.println(huawei...);}}static class Xiaomi extends Mobile {Overridepublic void call() {System.out.println(xiaomi...);}}public static void main(String[] args) {final HuaweiFactory huaweiFactory new HuaweiFactory();final Mobile mobile huaweiFactory.createMobile();mobile.call();} }3.抽象工厂模式 3.1 概念 抽象工厂模式提供一个接口用于创建一系列相关或相互依赖的对象。 通过使用抽象工厂及其产品接口来创建对象从而将客户端与具体的产品实现解耦。 3.2 使用场景 如果项目中业务要求属于这种三层关系的就可以考虑用抽象工厂两层关系的考虑简单工厂或工厂方法模式 适用三层关系 产品品牌子品牌手机华为手机mate60手机手机小米手机红米手机 两层关系 产品品牌手机华为手机手机小米手机 3.3 模型图解 角色手机总工厂、小米手机工厂、华为手机工厂、手机、小米手机、华为手机、红米手机、华为Mate60手机、华为P60手机 3.4 伪代码 public class AbstractFactory{}3.5 实战抽象工厂策略模式 3.5.1 业务方法调用 /*** 根据业务类型计算真正需要动账的存欠类型** param materialInboundDO* param walletTypeAndWeight* return*/private MapString, BigDecimal doBizType(MaterialInboundDO materialInboundDO, MapString, BigDecimal walletTypeAndWeight) {final AbstractFactory factory AbstractFactory.getFactory(materialInboundDO.getBillType());final MaterialWalletHandler materialInboundBean factory.getMaterialInboundOutboundBean(materialInboundDO.getBizType());return materialInboundBean.doBizType(walletTypeAndWeight);}3.5.2 抽象工厂创建二级工厂定义获取业务对象接口二级工厂去创建具体的业务对象 /*** 抽象工厂解决供应商/客户来料不同的业务类型对客户钱包的动账变化** date: 2023/7/18**/ public abstract class AbstractFactory {/*** 获得单据类型工厂** param billType 单据类型* return*/public static AbstractFactory getFactory(String billType) {if (BillTypeEnum.MATERIAL_CUSTOMER_IN.getKey().equals(billType)) {return new InboundCustomerFactory();} else if ( BillTypeEnum.MATERIAL_SUPPLIER_IN.getKey().equals(billType)) {return new InboundSupplierFactory();} else if (BillTypeEnum.MATERIAL_CUSTOMER_OUT.getKey().equals(billType)) {return new OutboundCustomerFactory();} else if (BillTypeEnum.MATERIAL_SUPPLIER_OUT.getKey().equals(billType)) {return new OutboundSupplierFactory();}throw new ServiceException(原料业务工厂不存在);}/*** 获得业务对象** param bizType 业务类型* return*/public abstract MaterialWalletHandler getMaterialInboundOutboundBean(String bizType); } 3.5.3 二级工厂 获得对象 /*** descr 客户来料工厂** date: 2023/7/18**/ public class InboundCustomerFactory extends AbstractFactory {Overridepublic InboundCustomerHandler getMaterialInboundOutboundBean(String bizType) {if (BizTypeEnum.M_CUSTOMER_IN.getKey().equals(bizType)) {return new InboundCustomerIn();}throw new ServiceException(客户来料业务类型不存在);} }3.5.3 二级工厂 具体的业务对象 /*** descr 客户客户来料** date: 2023/7/18**/ public class InboundCustomerIn implements InboundCustomerHandler {Overridepublic MapString, BigDecimal doBizType(MapString, BigDecimal walletTypeAndWeight) {return walletTypeAndWeight;} }3.5.3 处理的业务 顶层接口如下子业务处理方式 /*** descr 来料/出料业务定义接口** date: 2023/7/18**/ public interface MaterialWalletHandler {MapString, BigDecimal doBizType(MapString, BigDecimal walletTypeAndWeight);}中间层子接口之一用于规范业务 /*** descr 客户来料接口** date: 2023/7/18**/ public interface InboundCustomerHandler extends MaterialWalletHandler {}中间层接口实现1用于处理业务 /*** descr 客户客户来料** date: 2023/7/18**/ public class InboundCustomerIn implements InboundCustomerHandler {Overridepublic MapString, BigDecimal doBizType(MapString, BigDecimal walletTypeAndWeight) {return walletTypeAndWeight;} }中间层接口实现2用于处理业务 /*** descr 供应商发料兑料** date: 2023/7/18**/ public class OutboundSupplierMix implements OutboundSupplierHandler {Overridepublic MapString, BigDecimal doBizType(MapString, BigDecimal walletTypeAndWeight) {final HashMapString, BigDecimal walletTypeAndWeightMap new HashMap(walletTypeAndWeight);walletTypeAndWeightMap.remove(WalletTypeEnum.CASH.getKey());return walletTypeAndWeightMap;} }补充6大设计原则 1.单一职责 2.开放封闭 3.接口隔离 4.里氏替换 5.依赖倒置 6.迪米特法则 转送java常用设计模式 3.6 总结 以上实战中代码没有写的很完美还有许多改善的地方抽象工厂在实际运用中比一般都例子都相对复杂或可能写的理解的有所欠缺抽象工厂定义了对象怎么创建策略模式定义了业务怎么实现设计模式的使用主要是对业务代码进行简化或抽象尽量符合6大设计原则在技术人员沟通中只要说出某种设计模式就能知道业务大概是怎么处理的极大的减少了沟通成本
http://www.zqtcl.cn/news/345162/

相关文章:

  • 请人做网站谁来维护南宁营销型网站设计
  • 汕头做网站的公司西安建筑科技大学华清学院教务网
  • 免费行情网站在线石家庄正规制作网站公司
  • 站长工具网凡科网商城
  • 网站开发工程师需要会写什么区别沈阳网站建设建设公司哪家好
  • 营销型网站建设的优缺点利用海康威视做直播网站
  • 阿里手机网站开发框架怎么看网站被降权
  • 电视台做网站还是APP网络推广是什么意思
  • 浙江鼎兴建设有限公司网站wordpress看不到安装的主题
  • 琪觅公司网站开发c语言开发环境
  • 在哪个网站上做实验仪器比较好信息服务平台有哪些
  • 淘宝网站的建设目的是什么意思做雕塑设计的网站
  • 猎头网站模板个人社保缴费年限怎么查询
  • 博客网站设计及说明wordpress 显示 列表
  • 佛山制作手机网站莆田自助建站软件
  • 建邺做网站价格网站做换肤
  • 佛山有什么网站室内装饰设计怎么样
  • 智能建站与正常的网站购买 做网站 客户
  • 哪个是网络营销导向网站建设的基础微信商城开店需要费用吗
  • 宁波住房和建设局网站首页福州有做网站引流的吗
  • 国外科技类网站戴尔网站建设
  • 视频播放网站模板洞泾做网站公司
  • 深圳大学网站建设中美军事最新消息
  • gta5可用手机网站大全佛山网站建设服务
  • 智能建站软件哪个好智慧城市建设评价网站
  • 做网站用什么配资电脑织梦做的网站织梦修改网页模板
  • 手机网站制作吧网店营销策略
  • 管理员修改网站的参数会对网站的搜效果产生什么影响?网站建设新闻+常识
  • WordPress主题没有删除网站优化 工具
  • 建设外贸商城网站制作外国网站域名在哪查