Refactor when the code is difficult to understand and the team is not sure of what it does.
当代码难于理解,并且团队不能确定它做什么的时候进行重构。
Any new code should not be developed depending on these options being set, and you should look for ways to refactor your existing code away from using them if possible.
不应当基于被设置的这些选项来开发任何新代码,而且可能的话,您应当寻求方法来重构您的现有代码,避免使用它们。
Since I've captured early requirements in the form of test cases, I can easily refactor my code.
由于我已经通过测试用例捕获了早期需求,我可以轻松地对代码进行重构。
An important thing to note here is that you should either design and write new code, or refactor existing code.
这里要注意的重要一点是,您应该要么设计并编写新代码,要么重构现有的代码。
For example, if they see an opportunity for abstraction, they refactor to remove duplicate code from concrete implementations.
例如,如果他们看到有抽象的机会,他们就会进行重构,从具体的实现中除去重复的代码。
You may not have success with test-first development, but accumulating test collateral gives you the freedom to refactor your code.
您可能还没有在测试第一的开发中成功过,但测试会间接给您带来重构代码的便利。
You can refactor the code to isolate the data access functions into a separate file as homework.
作为练习,您可以对代码进行重构以将数据访问函数分离到单独的文件中。
This is the code I ultimately refactor into its own idiomatic pattern in "Leveraging reusable code, Part 1."
这就是在“利用可重用代码,第1部分”中我最终重构到它的惯用模式中的代码。
Tools can recognize errors and effectively restructure, or refactor, code.
工具可以识别错误和有效地重构代码。
Programmer tests also give developers courage to refactor the code, because a test failure tells the developer immediately if something's broken.
程序员测试还给予开发者重构代码的勇气,因为测试失败会立即告诉开发者是不是有地方出了问题。
There are several reasons that you might want to refactor code. The first is the stuff of legend: the hoary old code base for a venerable product is inherited or otherwise mysteriously appears.
您需要进行代码重构的原因可能有以下几个:传说中的第一个原因是:需要继承为某个古老产品而开发的年代久远的代码,或者突然碰到这些代码。
If you're already building code this way, you can better recognize and refactor bad implementations.
如果您已经在用这种方式构建代码,那么您就可以更好地识别和重构不好的实现。
If you have 100 percent code coverage on your project, you can refactor your code with impunity.
如果您的项目的代码覆盖率达到了100%,那么可以安全地重构代码。
When we refactor the code this way, we realize that we don't really care about observing buttons; we care about observing clicks.
当我们开始用这种方式重构代码的时候,我们意识到我们实际上不关心“观察”按钮;我们关心的是“观察”点击。
This partitioning of code by functionality makes it easy to identify particular responsibilities, refactor, and maintain.
这种通过功能划分代码的方式使我们更易识别特定职责、进行重构和维护工作。
That's not a problem over the long term, as long as you go back later and refactor the code into smaller bites.
从长远来说,这并不是一个问题,但您要记得回过头来将它重构为更小的部分。
Given that everyone on the team will be going through the "write a test, fix the code, refactor" cycle frequently, it's essential that you can both write and run tests efficiently.
假使项目中的每一个人都在周而复始地重复“写测试,修改代码,重构”,当然有必要使你的测试工作更加有效。
Tested code is easier to refactor, maintain, and enhance than code without corresponding test cases.
与没有相应测试案例的代码相比,经过测试的代码更容易重构、维护和增强。
It's far better to build code that's easy to refactor and exactly what you need.
最好是构建易于重构的并且完全是您所需要的代码。
To improve the code in Listing 6, I'm going to refactor it with SLAP in mind.
为了改进清单6中的代码,我要根据SLAP原则重构它。
Refactor your code and automate your tests.
重构代码并自动化测试。
Refactor and rename within user code
在用户代码内重构和重命名
As with JBuilder, one of Eclipse's most powerful features is the ability to refactor code.
eclipse与jbuilder类似,其中一个最强大的特性就是对代码的重构能力。
This is similar to trying to answer the question "how can I refactor my code and how much refactoring is appropriate for a given situation?"
这与试图回答“如何重构代码,在给定情形下多大程度的重构才是合适的?”
This solution helps us get the code quickly into WebSphere Studio, where the refactoring process is very easy — and working code (in any form) is easier to refactor than non-working code.
这个解决方案帮助我们快速的将代码导入WebSphereStudio,它使得重构过程非常容易——并且能工作的代码(无论什么形式)比不能工作的代码更容易重构。
Mary: "I'll need at least two days to write the tests, then I'd like to refactor the code, and then I'll add the features."
Mary:“我至少需要两天编写测试,然后我会重构这个代码,增加新的功能。”
Doing this puts your test data in one place and makes your code cleaner and easier to refactor.
这样做使得测试数据放在一个地方,从而使代码更干净,更容易重构。
Duplication harms projects because it resists attempts to make structural changes or refactor toward better code.
复制对项目有害,因为它不利于做出结构更改或重构为更好的代码。
Duplication harms projects because it resists attempts to make structural changes or refactor toward better code.
复制对项目有害,因为它不利于做出结构更改或重构为更好的代码。
应用推荐