Comments (2)
- 模式:用于解决反复发生的设计问题的简单,雅致的解决方案。
- 灵活性,模块性,已经创建可理解的,清晰的设计。
保持代码的价值观:让代码更加体现出,沟通,简单,灵活。
沟通
:代码可读性高,用代码体现出我们的业务逻辑。
简单
:简单设计,不要做无畏的抽象,降低逻辑的复杂性。
灵活
:可扩展性要高。
软件的成本
:
cost(total) = cost(develop) + cost(maintain)
维护的成本
:
cost(maintain) = cost(understand) + cost(change) + cost(test) + cost(deploy)
金钱的时间价值和未来的不确定性,由于不确定性的存在,实现策略应该更倾向于带来即时收益而非长远收益。
from refactoring-kata.
命令式
:阅读代码时,需要跟随着代码的执行流程。阅读者需要在大脑中建立起一个程序状态、控制流、数据流的模型。
声明式
:更多的是简单的描述。
命令式:
public static junit.framework.Test suite() {
Test result = new TestSuite();
...complicated stuff...
return result;
}
如果要知道,哪些测试会被执行?就需要知道,suite 的具体实现,需要读懂,理解后,才能知道它的功能。
声明式:
@RunWith(Suite.class)
@TestClasses({
SimpleTest.class,
ComplicatedTest.class
})
class AllTests {
}
要了解,哪些测试会被执行?只要找到注解的地方,就知道哪些测试就会运行。
from refactoring-kata.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from refactoring-kata.