Top Ten Pitfalls of MEL Scripting
10. Developing new scripts in the Script Editor is dangerous. If the script generates an infinite loop or Maya crashes your work will be lost.
9. Implicitly declaring arrays often results in the error "Cannot change float to float[]". Declare them explicitly (float $variable[];) before defining them.
8. List your dependencies somewhere in the script. Dependencies are acceptable, but a series of cascading dependencies makes maintenance difficult.
7. Remove or at least comment out de-bugging print statements when your finished. They slow down Maya and clutter the history in the Script Editor.
6. If the script runs but it doesn't make sense to you, it probably won't work for long. Investigate strange behavior.
5. Don't over expose your variables to the user. Having too many inputs makes a script frustrating to use and difficult to de-bug.
4. Once a script is functioning, add error checking. Don't assume the user will run it in the same conditions you are testing it in.
3. If you are modifying someone else's work, give them credit. Never remove someone else's copyright statements from a script. You may end up needing their help, and no one likes plagiarism.
2. If you intend to share your work, give yourself credit and definitely make sure the code works on someone else's machine. "Works on my machine" is not an acceptable response to a bug.
1. Evaluate the need for MEL. Just because it can be done with a script doesn't mean you should.