While reading the book <refactoring, improving the design of existing code>, I got some impressed tips and mark them as below.
When you use refactoring to develop software, you divide your time between two distinct activities: adding function and refactoring. When you add function, you shouldn't be changing existing code; you are just adding new capabilities. You can measure your progress by adding tests and getting the tests to work. When you refactor, you make a point of not adding function; you only restructure the code. You don't add any tests (unless you find a case you missed earlier); you only restructure the code. You don't add any tests (unless you find a case you missed earlier); you only change tests when you absolutely need to in order to cope with a change in an interface.
when should you refactor?
Here's a guideline Don Roberts gave me: The first time you do something, you just do it. The second time you do something similar, you wince at the duplication, but you do the duplicate thing anyway. The third time you do something similar, you refactor.
Tips:
Three strikes and you refactor.
分享到:
相关推荐
Refactoring Improving The Design Of Existing Code
This eagerly awaited new edition has been fully updated to reflect crucial changes in the programming landscape.Refactoring, Second Edition,features an updated catalog of refactorings and includes ...
Refactoring Improving The Design of Existing Code 重构已有代码
- **Refactoring Tools for Visual Studio**:针对.NET平台的重构插件。 **5. 面向对象设计的优化** 重构不仅仅局限于简单的代码优化,它还涉及到更深层次的面向对象设计原则。通过遵循良好的设计原则,如单一...
《重构:改善既有代码的设计》是一本专注于软件开发领域的经典著作,由Martin Fowler著述,主要探讨了如何通过重构技术来提升现有代码的设计质量。重构是软件开发过程中的一个重要环节,它并不改变软件的外部行为,...
5. **Replace Type Code(替换类型码)**:在处理条件分支语句或switch语句时,如果发现有大量针对同一概念的类型码,可以考虑使用类代替,引入多态性,提高代码的灵活性和可扩展性。 书中详细阐述了这些重构手法的...
这本书专注于一个非常重要的软件开发实践,即重构(Refactoring)。重构指的是在不改变外部功能的前提下,对软件的内部结构进行改善的过程。该书的描述提到了书中包含的每个重构方法的书签,为读者查找提供了便利。...
《Refactoring: Improving the Design of Existing Code》是软件开发领域的一本经典著作,由Martin Fowler著述。这本书深入探讨了重构这一关键的软件工程实践,对于Java开发者来说尤其具有指导意义。重构是指在不...
《代码重构:改善既有代码的设计》是一本由Martin Fowler所著的经典著作,它深入探讨了如何通过重构来提升软件设计的质量。重构是软件开发过程中的一个重要环节,它并不改变代码的功能,而是通过优化代码结构,使其...
《重构:改善既有代码的设计》是马丁·福勒(Martin Fowler)的一本经典著作,它在IT领域中具有深远的影响,特别是在软件开发和维护方面。这本书详细阐述了如何通过重构来提升现有代码的设计质量,从而使得软件系统...
"Refactoring" was conceived in Smalltalk circles, but it wasn't long... The key to keeping code readable and modifiable is refactoring—for<br>frameworks, in particular, but also for software in general.
《重构 - Improving the Design of Existing Code》是马丁·福勒(Martin Fowler)的经典著作,这本书深入探讨了软件开发中的一个重要实践领域——重构。重构是指在不改变代码外在行为的前提下,改善其内部结构,使...
《重构:改善既有代码的设计》是马丁·福勒(Martin Fowler)的经典著作,由熊节翻译,于2010年4月在中国由人民邮电出版社出版。这本书深入探讨了软件开发过程中的一个重要环节——重构,即在不改变代码外在行为的...
### 经典书籍《重构》(Refactoring: Improving the Design of Existing Code) #### 书籍概述 《重构:改善既有代码的设计》是一本由马丁·福勒(Martin Fowler)、肯特·贝克(Kent Beck)、约翰·布兰特(John ...
重构-改善既有代码的设计(Refactoring Improving the Design of Existing Code)
《重构—改善既有代码的设计》是Martin Fowler所著的一本关于软件开发领域重构技术的经典之作。本书详细探讨了如何通过重构改善现有代码的设计,同时不改变软件的外部功能。重构是一种软件开发技巧,通过这种方式,...