1. Memory Management – Always, Dispose SPSite and SPWeb Objects if you have created them in your code. You can employ certain coding techniques to ensure object disposal. These techniques include using the following in your code:
* Dispose method
* using clause
* try, catch, and finally blocks
Note : SPContext objects are managed by the SharePoint framework and should not be explicitly disposed in your code. This is true also for the SPSite and SPWeb objects returned by
SPContext.Site, SPContext.Current.Site, SPContext.Web, and SPContext.Current.Web.
Feature Receiver - Features do not automatically remove the deployed resources when gets de-activated. For e.g. a Custom webpart in the webpart gallery is not removed even after solution retraction. hence, it’s the responsibility of the Feature to clean up after itself when it is deactivated by using a Feature receiver.
Keep Files UnCustomized – Try to keep your files UnCustomized or on the server. Avoid editing them in SharePoint designer or by using SharePoint API if not needed. Customizing the files can cost you alot in terms of Performance and space as every Customized or Unghosted file in is subjected to safe mode parser.Its basically, a little Check to see that everything on the Page is allowed to run in SharePoint.
Deciding how to package components : dediding how to package depends largely on where the components are being deployed. It is always recommended to deploy Custom components for sharepoint as Solution packages.





