在代码级别,你可以重构引入参数,接着你的测试场景将同样使用新的参数。
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.
应用推荐