zoukankan      html  css  js  c++  java
  • 重构的手段

    1. Extract Method 提取函数

    1. Replace Temp with Query 以查询取代临时变量

    1. Introduce Parameter Object 引入参数对象

    1. Preserve Whole Object 保持对象完整

    1. Replace Method with Method Object 以函数对象取代函数

    1. Decompse Conditional 分解条件表达式

    1. Extract Class 提炼类

    1. Extract Subclass 提炼子类

    1. Inline Class 将类内联化

    1. Extract Interface 提炼接口

    1. Duplicate Observed Data 复制"监视数据"

    1. Rename Method 函数改名

    1. Introduce Assertion 引入断言

    1. Collapse Hierarchy 折叠继承体系

    1. Remove Parameter 移除参数

    1. Remove Method 移除函数
    1. Pull UP Method 函数上移

    1. Form Template Method 塑造模板函数

    1. Move Method 搬移函数

    1. Extract Superclass 提炼超类

    1. Replace Conditional with Polymorphism 以多态取代条件表达式

    D

    1. Replace Type Code with Subclass 以子类取代类型码

    1. Replace Type Code with State/Strategy 以State/Strategy 取代类型码

    1. Replace Parameter with Explicit Methods 以明确函数取代参数

    1. Introduce Null Object 引入Null对象

  • 相关阅读:
    js实现快速排序
    使用NodeList
    变量提升问题
    使用Location对象查询字符串参数
    一天一小段js代码(no.2)
    一天一小段js代码(no.1)
    JS闭包中的this对象
    JS数组去重
    FreeCodeCamp----Intermediate Algorithm Scripting解法
    关于表单验证
  • 原文地址:https://www.cnblogs.com/kexinxin/p/10011961.html
Copyright © 2011-2022 走看看