Came across some nice videos on best practices from Ted Pattison. Here is the gist of what he suggests.
Development
- Use Site template instead of the site definition. Hell during the upgrades from one version of SP to another.
- Deploy the site templates as sandboxed solution in the staging/test environment to check out the bottlenecks and depending on the needs deploy them in production as sandboxed or farm based.
- Use Feature Stapling.
element to staple a feature to a site definition. - Version Features and anticipate for feature upgrades.
- Hide the Features that have been stapled as hidden. Use the Visual studio properties windows to hide them. This ensures that they are not seen by the site admins.
- Keep in mind about various cycles of Activation and Deactivation. Deactivation leaves behind the list instances and next time activations will break during the deployment. Ensure to write appropriate code to either delete or backup previous versions before deleting them.
Testing and Deployment.
- Use the SPDisposeCheck utility sparingly.
- Ensure to use the keyword using() especially to SPSite object to let the .net framework take care of the disposing. Do not dispose the SPSite object created by others that is received through the event receivers or anything like that. Ex: properties.parent.site
- Test your environment without any SDKs installed. Probably a VM or something would be good. Keep your QA environment with at least two boxes. One for the Web/App and another for the DB Server.
- Test your QA machines on debug mode to catch any unknown errors.
- If you are deploying a farm based solutions prefer to use a script like PowerShell to install them.
- Updates to web.config needs to be automated. For safe control entries you can add data to the manifest file. However for other entries use the SP Object model. See some methods of updating web.config http://msdn.microsoft.com/en-us/library/ms439965.aspx / http://msdn.microsoft.com/en-us/library/bb861909.aspx
For more information check out the videos @ http://msdn.microsoft.com/en-us/sp2010devtrainingcourse_bestpractices_unit