InnovationM Sencha ExtJS Best Architecture Design Coding Practices

Sencha Touch and Ext JS – Best Architecture, Design and Coding Practices

We have identified some of the best practices that we need to follow while working on architecture, design and development of Sencha Touch and Ext JS applications. We will keep on adding more and more to it. Stay tuned…

Best Coding Practices

Nesting of Function calls (Avoid it)

Avoid nesting of function calls. This degrades the code readability and impacts performance.
Ex.
Incorrect
store.getProxy().setExtraParam();

Correct:
var proxy = store.getProxy();
proxy.setExtraParam();

In the above example, if proxy object has to be used again in the same function then we already have access to that object. No need to call store.getProxy() again. This improves performance.

Message key naming convention

1. Validation Messages
MSG_VALIDATION_NAME_REQUIRED = ‘Name is Required’

2. Task In Progress Messages
MSG_PROGRESS_CREATE_USER = ‘Creating User…’

3. Confirmation Messages
MSG_CONFIRM_DELETE_USER = ‘Do you want to delete user?’

4. Global
MSG_VALIDATION_ALERT_TITLE = ‘Check Data’
MSG_CONFIRM_ALERT_TITLE = ‘Confirm’
MSG_FAILURE_SERVER = ‘There is an unexpected problem. Please try again.’
MSG_TITLE_FAILURE_SERVER = ‘Unexpected Error’

Leave a Reply