1 / 90
文档名称:

怎样写酷代码.ppt

格式:ppt   大小:3,382KB   页数:90页
下载后只包含 1 个 PPT 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

怎样写酷代码.ppt

上传人:sanshenglu2 2021/8/3 文件大小:3.30 MB

下载得到文件列表

怎样写酷代码.ppt

文档介绍

文档介绍:目录
IF/SWITCH语句

复杂的、嵌套的IF/SWITCH语句
循环语句.

多层嵌套的循环语句,经常跟IF语句一起使用
A
B
圈复杂度

从理论上分析这两种坏味道
C
.

如何解决?值得探讨的课题
D
*
代码的坏味道带来的问题
破窗效应
代码的坏味道带来的问题
破窗效应
代码的坏味道带来的问题
冰山一角
代码的坏味道带来的问题
软件成本
Costtotal = costdevelop + costmaintain
Costmaintain = Costunderstand + costchange + costtest+costdeploy
Costmaintain >> costdevelop
代码的坏味道之IF语句

if (employeePositionList != null&& () > 0) {
for (EmployeePosition ep : employeePositionList) {
(().getIdx(), ());
}
(());
}

if (()!= null && () !="")
(() + " " + time);
if (()!=null &&
()!="")
{.
代码的坏味道之IF语句


byte[] bufKey = RedisCacheInterceptor.
(());
byte[] bufValue = (bufKey);
if (bufValue != null) {
try {
return RedisCacheInterceptor.
(bufValue, session);
} catch (IOException e) {
();
} catch (ClassNotFoundException e) {
();
}
}
return null;
代码的坏味道之IF语句


if (orgId != null) {
List<EmployeePosition> employeePositionList =orgDataService
.getEmployeePositionByOrgId(getTenantId(), orgId);
Map<Long, EmployeeMain> empMap = new HashMap<Long,EmployeeMain>();
List<EmployeeMain> empList = new ArrayList<EmployeeMain>();
if (employeePositionList != null&& () > 0) {
for (EmployeePosition ep : employeePositionList) {
(().getIdx(), ());
}