Most of the Share UI functionality can be traced back to a web script in one place or another. Sometimes it is useful to be able to override the controller or template of one of these out-of-the-box web scripts. Same things goes for other out-of-the-box code for things like pages and dashlets.
The preferred way of modifying out-of-the-box code is by using Surf Extension Modules. For more information, see Surf Extension Modules.
Architecture Information: Share Web Client Architecture