1 Star 0 Fork 5

赵浩全 / marion-code-standard

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README

我的社交资料

微信公众号 微信群(备注:加群)

代码规范与性能优化的100个建议

1. 创建对象使用@Builder

2. 让接口职责单一

一次电话通信包含四个过程:拨号、通话、回应、挂机

3. 增强类的可替换性

所有引用基类的地方必须能透明地使用其子类的对象

4. 依赖抽象而不是实现

在面向过程开发中,我们考虑的是如何实现,依赖的是每个具体实现,而在OOP中,则需要依赖每个接口,而不能依赖具体的实现,比如我们要到北京出差,应该依赖交通工具,而不是依赖的具体飞机或火车,也就是说我们依赖的是交通工具的运输能力,而不是具体的一架飞机或某一列火车。这样的依赖可以让我们实现解耦,保持代码间的松耦合,提高代码的复用率,这也是依赖倒置原则(Dependence Inversion Principle,简称DIP)提出的要求。

5. 策略模式优化if-else

6. 行为参数化传递代码

XMind - Trial Version

Empty file

About

JAVA代码规范与性能优化 expand collapse
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
1
https://gitee.com/zhao-haoquan/marion-code-standard.git
git@gitee.com:zhao-haoquan/marion-code-standard.git
zhao-haoquan
marion-code-standard
marion-code-standard
master

Search