refactoring重构内容摘要:
Lazy Class • Speculative Generality • Temporary Field • Message Chains • Middle Man • Inappropriate Intimacy • Alternative Classes with Different Interfaces • Inplete Library Class • Data Class • Refused Bequest • Comments Copyright 2020 Chinaxp. All rights reserved 13 Refactoring之 Extract Methods void printOwing() { //print banner (“*********”)。 (“Banner”)。 (“*********”)。 //print details (name: + _name)。 (amount + getOutstanding())。 } void printOwing() { printBanner()。 printDetails(getOutstanding())。 } Void printBanner(){ //print banner (“*********”)。 (“Banner”)。 (“*********”)。 } void printDetails (double outstanding) { (name: + _name)。 (amount + outstanding)。 } Copyright 2020 Chinaxp. All rights reserved 14 Refactoring之 Extract Methods 一个复杂些和现实些的例子 String name = (Name)。 if( name != null amp。 amp。 () 0 ){ ...... } String age = (Age)。 if( age != null amp。 amp。 () 0 ){ ...... } String name = (Name)。 if( !isNullOrEmpty( name ) ){ ...... } String age = (Age)。 if( !isNullOrEmpty( age ) ){ ...... } private boolean isNullOrEmpty( final String string ){ if( string != null amp。 amp。 () 0 ){ return true。 }else{ return false。 } } Copyright 2020 Chinaxp. All rights reserved 15 Refactoring之 Inline Method 如果一个 Method中的 逻辑太简单,则把其中的代码移到调用它的代码, 取消这个 Method。 int getRating() { return (moreThanFiveLateDeliveries()) ? 2 : 1。 }。refactoring重构
相关推荐
急性心力衰竭的有效性 安慰剂, n=580 安慰剂 , ivgtt 48h ,用视觉类比量表评价治疗 5天后患者自觉呼吸困难程度的变化 1 24h后用李克特量表定性评估患者患者自觉呼吸困难程度的变化 Serelaxin, n=581 30ug/kg/d, ivgtt 48h Lancet 2020。 381: 2939, N=1161,起病时间 < 16h,符合 AHF入选标准:呼吸困难
the non budgetary sector, the minimum wage has an important role in the protection of the poor part of the population The real wage and poverty, The inflation was higher than the wages amp。
URL RMS服务器集群 URL是在安装过程中配置的 需要管理员来设置到 Intra集群 URL Extra集群 URL是可选的 在服务器颁发发布许可( CLC)时,将 URL写入 在发行内容时,将 URL复制到发行许可( PL)中 证书服务器的集群 URL将被发布到 serviceConnectionPoint 最佳实践概览 最佳实践 最佳实践可以分为三个方面 设计 部署 管理
航线。 下半年 , 开通集装箱电子标签系统上海至欧洲的中欧航线。 目前集装箱电子标签技术正受到全球关注。 集装箱智能电子标签的信息共享技术兼顾物流 、 港口 、 船公司的信息需求 , 还可以满足货物用户 、 船 /货代理 、 海关 、 边境商检的需要。 中国物流与采购联合会 2020/11/17 9 二、 RFID在物流中的应用 上海危险化学气瓶安全监管信息平台 • 电子标签内容 :归属单位 、
本生理或生化缺陷知之甚少。 What is FH? What Causes FH? How is FH Inherited? What is FH? • Familial Hypercholesterolemia (FH) is an inherited disorder that causes very high cholesterol levels and greatly increases
“我没有一双像你一样有力的翅膀,也没有四条善跑的长腿,怎么上得去呢。 ” “是啊,这山是太高了。 不过你不登上山顶,怎么能看到大海呢。 ” “ 你想看海吗。 ” “ 是啊,可是这山太高了,我上不去。 ” “ 这石阶你能跳上去吗。 ” “ 这有什么难的。 ” “ 再跳一下。 ” “ 好。 你一定能看到大海。 ” 这有什么难的