前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >关于SAP UI5 CRM Reuse Fiori应用的代码审查

关于SAP UI5 CRM Reuse Fiori应用的代码审查

作者头像
Jerry Wang
发布2019-05-31 11:26:35
3760
发布2019-05-31 11:26:35
举报

目录

clipboard1
clipboard1

1. Question about maven build output

clipboard2
clipboard2

If we open the target folder: What is exactly the usage of these four parts?

下图这四种资源有什么用处?

clipboard3
clipboard3

Reason why I asked: the content between 1 and 2 are the same, 3 and 4 are the same.

2. Useless CSS style

Are these CSS styles still used?

clipboard4
clipboard4

上面的CSS似乎没有用到。

I don’t think so since a pure text search shows no *.js are using them.

clipboard5
clipboard5

3. Why we choose sap.m.panel as aggregation container?

clipboard6
clipboard6

I know the children element contained in the aggregation would also be rendered in the runtime:

clipboard7
clipboard7

包含在这些aggregation的子控件在运行时被渲染。

clipboard8
clipboard8

However, why we choose panel as placeholder but not other one like XXXlayout?

4. Unnecessary require statement about “…NonLogTypeNoteListItem”

clipboard9
clipboard9
clipboard10
clipboard10
clipboard11
clipboard11

5. Duplicate code in two IF branch

clipboard12
clipboard12

6. Unused comment

clipboard13
clipboard13

It could be deleted now

7. Confusing variable name

clipboard14
clipboard14

Should be noteEditDialog instead.

8. Magic number still exists

clipboard15
clipboard15

9. Better constant definition approach

Follow this design:

clipboard16
clipboard16

Use this instead:

clipboard17
clipboard17

10. Hard code text cannot be translated

clipboard18
clipboard18

11. Performance of this.getProperty

Take this code for example:

clipboard19
clipboard19

In the runtime lifecycle, the value of these properties can never change:

clipboard20
clipboard20
clipboard21
clipboard21

Do a performance test on this.getProperty:

在this.getProperty方法加上性能数据的采集:

clipboard22
clipboard22
clipboard23
clipboard23

After clicking add button, there are more than 1200 times getProperty call, actually most can be avoided.

发现随便点击一个Add按钮,会触发一千多次的getProperty调用。而大多数其实都可以避免的。

clipboard24
clipboard24
clipboard25
clipboard25

If we call getProperty on these properties once in init, we can save 1200 * 0.5 = 0.6s

如果我们在onInit里只调用一次getProperty,然后把结果缓存起来,就可以节省1200 * 0.5 = 0.6s的时间。

12. Unused argument

clipboard26
clipboard26

13. Lengthy code

Didn’t try in js yet, can we use “return ( oValue1 – oValue2 )”?

clipboard27
clipboard27
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019年02月01日,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1. Question about maven build output
  • 2. Useless CSS style
  • 3. Why we choose sap.m.panel as aggregation container?
  • 4. Unnecessary require statement about “…NonLogTypeNoteListItem”
  • 5. Duplicate code in two IF branch
  • 6. Unused comment
  • 7. Confusing variable name
  • 8. Magic number still exists
  • 9. Better constant definition approach
  • 10. Hard code text cannot be translated
  • 11. Performance of this.getProperty
  • 12. Unused argument
  • 13. Lengthy code
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档