在代码级别,你可以重构引入参数,接着你的测试场景将同样使用新的参数。
At the code level, you could instead use an Introduce parameter refactoring, and your test scenarios would likewise reflect the new parameter.
比尔:你在《重构》一书中提到:“代码应该实现任何逻辑一次且仅一次,这是良好设计的要素”。
Bill Venners: in your book, Refactoring you say, "the code says everything once and only once, which is the essence of good design."
在重构这个长达100行的方法时,你可能会发现一些诸如责任分配(responsibility allocation)不合理这样的设计问题。
In the course of refactoring a 100-line method, you find that some bad design decisions were made about responsibility allocation.
选择重构菜单选项后弹出“重构”对话框,你可以在原来选择的基础上继续对挑选出来的元素进行重构。
Selecting the refactor menu options brings up the refactor dialog and allows you to continue refactoring the elements based on the selections made.
BillVenners:在《重构》一书中你写道:“在学会重构之前,我总是力图找到灵活的方案。”
Bill Venners: in refactoring you write, "Before I used refactoring I always looked for flexible solutions."
随着项目的成熟,在把应用系统重构为n -层企业级别的应用系统时,你可以依赖或者不依赖编译器和测试框架。
As your project matures, you can lean on the compiler and test framework as you refactor into an n-tier, enterprise-grade application. Or not.
当你工作在以往代码基础上改进游戏时候,重构是你需要记住的一样很重要的事。
Refactoring is still the most important thing you have to remember when working over existing code and improving your game.
比尔:你在《重构》一书中提到,曾经碰到过一个团队,所有成员都将自己的接口发布给其他成员,结果大家常常是不堪其苦。
Bill Venners: in Refactoring, you talk about a development team you once encountered in which each team member was publishing interfaces to others and going through lots of conniptions.
比尔:在《重构》这本书中,你写道:“通过写测试,我提高了作为一个程序员的工作效率。”能谈谈对鲁棒性、质量和可靠性的影响么?
Bill Venners: in Refactoring, you write: "I write tests to improve my productivity as a programmer." What about robustness, quality, and reliability?
在方法中空行应该分割功能块,但如果一个方法有太多的功能块,那么通常意味着你应该重构到多个方法中。
Whitespace within methods should separate functionality, but having too many sections in a method often means you should refactor into several methods.
通常,当你在调试一段代码的时候,对之进行重构也相对容易些。重构后,你就可以轻易地发现漏洞在哪里。
It's often easier to refactor that code while you're debugging it, so you can easily find where the bug is.
你在《重构》一书中写道:“编写能快速运行的软件的秘诀就在于先编写可性能调优的软件,然后对执行速度进行调优。”
Bill Venners : You say in Refactoring, "The secret to fast software in all but hard real time contexts is to write tunable software first, and then to tune it for sufficient speed."
比尔:你在《重构》这本书里写道:“如果你打算重构,那么最根本的先决条件是有完善的测试。”
Bill Venners : You say in your book Refactoring: "If you want to refactor, the essential precondition is having solid tests."
比尔:你在《重构》这本书里写道:“如果你打算重构,那么最根本的先决条件是有完善的测试。”
Bill Venners : You say in your book Refactoring: "If you want to refactor, the essential precondition is having solid tests."
应用推荐