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

目录

1. Question about maven build output

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

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

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?

上面的CSS似乎没有用到。

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

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

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

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

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

4. Unnecessary require statement about “…NonLogTypeNoteListItem”

5. Duplicate code in two IF branch

6. Unused comment

It could be deleted now

7. Confusing variable name

Should be noteEditDialog instead.

8. Magic number still exists

9. Better constant definition approach

Follow this design:

Use this instead:

10. Hard code text cannot be translated

11. Performance of this.getProperty

Take this code for example:

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

Do a performance test on this.getProperty:

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

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

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

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

13. Lengthy code

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

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

扫码关注云+社区

领取腾讯云代金券