当我隔离和移除重复代码后,数字分类器和质数检验器就变得更简单了。
Once I've isolated and removed the duplicated code, both the number classifier and the prime-number tester are much simpler. Listing 4 shows the refactored number classifier.
这样反反复复。通过简单的移除重复代码,我最终“偶得”一个美妙而优雅的模式。
Time and time again, I've found that by simply removing duplication I accidentally stumble onto a really nice elegant pattern.
应用推荐