最大一类重构是实现了类内部代码重组的重构方法。
The largest variety of refactorings are those that reorganize code within a class.
我们看到过很多内部代码,使用值类型来提高性能,同时减小工作集大小。
We've seen some internal code where making it inline (ie, as a value type) improved perf as it decreased working set.
对于文本编辑器这样复杂的代码,外部测试者无法生成针对特定例程的测试—测试者不太了解内部代码组织。
For a complex piece of code like a text editor, an external tester cannot generate tests targeting specific routines-the tester won't have much idea about internal code organization.
In general, good programming style says you put in comments that are going to be valuable in helping you as a reader understand what's going on inside of the code.
通常来说,优秀的编码风格意味着,你要放进去的注释,在帮助代码阅读者,理解代码内部,是怎么工作的。
OK, so far though, I've just shown you what happens inside a peace a code. It raises an exception. It goes to that accept clause. We don't have to use it just inside of one place.
好了,我已经给你们看了,代码内部发生了什么,它报了一个异常,然后就到了处理的片段,我们不该就在一个地方用它。
We're going to call binary search, it's going to take the list to search and the element, but it's also going to say, here's the first part of the list, and there's the last part of the list, Well, it checks to see, is it bigger than two?
我们将要调用这个二分查找,它将会在列表里面搜索元素,假定这里是,列表的第一个元素,那里是列表的最后一个元素,代码内部到底做了什么?
应用推荐