Chapter 1:Refactoring,a First Example 重构,第一个例子 The Starting Point 起点 The First Step in Refactoring 重构第一步 Decomposing and Redistributing the Statement Method 分解并重组slalemenl方法 Replacing the Conditional Logic on Price Code with Polymorphism 用多态
Chapter 1:Refactoring,a First Example 重构,第一个例子 The Starting Point 起点 The First Step in Refactoring 重构第一步 Decomposing and Redistributing the Statement Method 分解并重组slalemenl方法 Replacing the Conditional Logic on Price Code with Polymorphism 用多态
Chapter 1:Refactoring,a First Example 重构,第一个例子 The Starting Point 起点 The First Step in Refactoring 重构第一步 Decomposing and Redistributing the Statement Method 分解并重组slalemenl方法 Replacing the Conditional Logic on Price Code with Polymorphism 用多态
hapter 1:Refactoring,a First Example 重构,第一个例子 The Starting Point 起点 The First Step in Refactoring 重构第一步 Decomposing and Redistributing the Statement Method 分解并重组slalemenl方法 Replacing the Conditional Logic on Price Code with Polymorphism 用多态代
前两篇(思路和方法、重构计划)从大的方面上谈了关于重构的话题,这次从小的代码上来看。我们来看下一个的代码如何从简单到复杂,然后重构这些代码。单个对象复制在初步的需求中有个很简单的业务,就是定义销售合同,并且合同中可以配置产品设备数据,如下:其中有个业务功能就是需要对已经存在的销售合同进行复制、剪贴和粘贴的工作。对于程序来说,它其实就需要实现IClone接口就可以了,代码/// /// 复制/// public object Clone(){ TestObj copiedObj = new
前两篇(思路和方法、重构计划)从大的方面上谈了关于重构的话题,这次从小的代码上来看。我们来看下一个的代码如何从简单到复杂,然后重构这些代码。单个对象复制在初步的需求中有个很简单的业务,就是定义销售合同,并且合同中可以配置产品设备数据,如下:其中有个业务功能就是需要对已经存在的销售合同进行复制、剪贴和粘贴的工作。对于程序来说,它其实就需要实现IClone接口就可以了,代码/// /// 复制/// public object Clone(){ TestObj copiedObj = new