Maya has many MEL scripts it uses for its user interface and other operation details. You can examine these scripts to see the techniques of professional script writers at Autodesk. The scripts are in the startup and others directories at these locations by default:
(Linux) /usr/autodesk/maya<version>/scripts
(Windows) drive:\Program Files\Autodesk\Maya<version>\scripts
(Mac OS X) /Applications/Autodesk/maya<version>/Maya.app/Contents/scripts
If you want to modify scripts in this directory to alter the interface, copy them to your local scripts directory first. If a script in your local scripts directory has the same name as a script in the internal script files directory, the one in your local scripts directory executes.