As a developer, if you have coded long enough on a project and know the CRM instance well, it is very easy to get complacent. It could also be that you’re tired. You need to just get the functionality out of the way and go home.
And it is precisely during such times that the best practices are thrown out of the window. When we do that, it will eventually come back to make you realize your folly in some way or the other. I have experienced this!
Keep your libraries short and simple:
Keep the libraries short and simple. It will increase performance and improve maintainability.
Readability is a big issue. Once a code is minified it looks like one major paragraph. It becomes quite difficult to debug issues in the code as well. The non-minified version of the code also needs to be maintained in a Source Control or at least in the Web Resources of the organization.
This helps the developer to debug issues.
Keep separate libraries for the form and ribbon:
Readability is a major advantage. If a developer needs to address an issue related to a button not appearing, he doesn’t need to go through a massive library that contains all functions. He can look at only the ribbon library and debug the issue. Have the names of the button in the function name. For example,
//code goes here.
As the name indicates, the library contains the display rules of button 1.
Performance Analyzer tools:
- Open the form which needs to be analyzed
- Control + Shift + Q
- Click the enable button
- Reload the form
- Hit Control + Shift + Q again
It is not necessary that these have to be done only when the performance is going down. One can be always proactive. This can be done before new functionality is introduced to Production to make sure that it is not expensive.