alterno logo 2021-02

Seven deadly sins of SAPUI5 developer

We have been exposed to a variety of SAPUI5 coding practices – some of them are good, but most of them are very complex and unmanageable.

Even if you are planning to use SAP Web IDE instead of Eclipse – you are still free to code your SAPUI5 logic wrongly, as JavaScript is a very decoupled & mistake-graceful platform.

How do you standardize your SAPUI5 apps? Here is a shortlist of things you DON’T DO during SAPUI5 development:


Don’t use JavaScript to build your views / fragments / popups – use XML views and fragments instead. All Fiori apps are build in such a way – it provides better MVC implementation and logic separation


Don’t use $.ajax calls to process ODATA calls – use standard SAP ODATA libraries, we recommend using sap.ui.model.odata.v2.ODataModel or sap.ui.model.odata.v4.ODataModel


Don’t instantiate multiple ODATA models to perform calls – define it once in your manifest file and access it by this.getView().getModel(“modelName”)


Don’t put text inside your views for labels / field titles / etc. – use i18n resources for all cases, as you might need to translate your app one day


Don’t replicate your code – sometimes formatters & general methods will be reused by different views, so we recommend placing them in separate JS file


Don’t use JS code to bind data to elements (.bindRows() / .bindItems() / .bindAggregation())  – bind your data through XML instead, for example <Table items=”{JSONModel>TableItems}”>


Don’t use JSON models for large data sets – filtering and sorting arrays larger than 500 rows might affect your browser response time and make users feel dizzy. We recommend binding ODATA entities directly to view elements


Not sure about the quality of your SAPUI5 projects? Feel free to CONTACT US TODAY  – perform your code review with one of our experienced SAPUI5 developers!

 

Leave a Reply

Any questions?

Just write us a message!

Fill out the form and we will be in touch as soon as possible!