软件工程

本类阅读TOP10

·PHP4 + MYSQL + APACHE 在 WIN 系统下的安装、配置
·Linux 入门常用命令(1)
·Linux 入门常用命令(2)
·使用 DCPROMO/FORCEREMOVAL 命令强制将 Active Directory 域控制器降级
·DirectShow学习(八): CBaseRender类及相应Pin类的源代码分析
·基于ICE方式SIP信令穿透Symmetric NAT技术研究
·Windows 2003网络负载均衡的实现
·一网打尽Win十四种系统故障解决方法
·数百种 Windows 软件的免费替代品列表
·收藏---行百里半九十

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
Principles of Refactoring--------reading Refactoring chapter 2

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

Refactoring:
     A change made to the internal structure of software to make it easier to understand and cheaper to modify without changing its observable behavior.
事不过三:
  The first time you do something,just do it,The second time you do something simular,you wince at the duplication,but you do the duplicate thing anyway. The third time you do somthing similar,you refactor.                ----------Don Roberts
Remember:
  Code has to work mostly correctly before you refactor!
第二章主要介绍了
1,为什么使用Refactor
2,什么时候需要Refactor
3,Refactor可能带来的问题

下边让我来逐一介绍:(其实也没有什么好介绍的,大体知道就行了,他所说明的东西我们想想一般都觉得是正确的,呵呵,还是让我来理一下思路)
(Refactoring的主要目的是让代码readable and easy to modify,Refactoring modifies the existing code in such a way that it doesn't affect the observable behavior.

1,Why should you refactor?
  a.  improves the Design of software
  b.  make software easier to understand
  c.  helps you find bugs(as Refactor tear your code into parts)
  d.  help you program faster(in the long run)

2,  When should you refactor?
a. when you add function
b. when you need to fix a bug
c. as you do a code review

3,Problems with refactoring
a. Databases(这里作者讲的我不是很明白,可能是我对数据库设计的实践比较少吧)
b. Changing interfaces (especially when the published interfaces)

最后让这一章以Refactoring和Design的关系来结束:
最好的Process是:
    Design first,但是不一定要把考虑到的所有未来变化的编码全部放到你的设计中来,前提是你能保证这种变化对于refactor来说是可以比较简单的解决的,从而我们可以看出Refactor和Design是相辅相成的,只不过design为主,refactor为辅,refactor使我们可以进行simple design at first,but end up with good-designed code!~



    Ok,finish here!!






相关文章

相关软件