关于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的子控件在運(yùn)行時(shí)被渲染。
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方法加上性能數(shù)據(jù)的采集:
After clicking add button, there are more than 1200 times getProperty call, actually most can be avoided.
發(fā)現(xiàn)隨便點(diǎn)擊一個(gè)Add按鈕,會(huì)觸發(fā)一千多次的getProperty調(diào)用。而大多數(shù)其實(shí)都可以避免的。
If we call getProperty on these properties once in init, we can save 1200 * 0.5 = 0.6s
如果我們?cè)趏nInit里只調(diào)用一次getProperty,然后把結(jié)果緩存起來,就可以節(jié)省1200 * 0.5 = 0.6s的時(shí)間。
12. Unused argument
13. Lengthy code
Didn’t try in js yet, can we use “return ( oValue1 – oValue2 )”?
要獲取更多Jerry的原創(chuàng)文章,請(qǐng)關(guān)注公眾號(hào)"汪子熙":
總結(jié)
以上是生活随笔為你收集整理的关于SAP UI5 CRM Reuse Fiori应用的代码审查的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: xs有锁和无锁的区别(好看的小说都在这)
- 下一篇: 一些SAP UI5代码审查的例子