目录

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

1. Question about maven build output

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

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

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

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

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?

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

上面的CSS似乎没有用到。

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

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

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

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

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

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

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

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

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

4. Unnecessary require statement about “…NonLogTypeNoteListItem”

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

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

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

5. Duplicate code in two IF branch

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

6. Unused comment

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

It could be deleted now

7. Confusing variable name

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

Should be noteEditDialog instead.

8. Magic number still exists

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

9. Better constant definition approach

Follow this design:

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

Use this instead:

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

10. Hard code text cannot be translated

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

11. Performance of this.getProperty

Take this code for example:

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

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

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

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

Do a performance test on this.getProperty:

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

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

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

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

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

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

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

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

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

13. Lengthy code

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

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

要获取更多Jerry的原创文章,请关注公众号"汪子熙":
关于SAP UI5 CRM Reuse Fiori应用的代码审查

相关文章:

  • 2021-06-01
  • 2022-12-23
  • 2021-10-21
  • 2021-11-08
  • 2021-04-28
  • 2021-04-21
  • 2021-09-22
  • 2021-12-11
猜你喜欢
  • 2021-09-12
  • 2021-11-29
  • 2021-09-10
  • 2021-11-11
  • 2021-08-31
  • 2021-07-29
相关资源
相似解决方案