Home > SSW Standards > Rules > Rules to Better SharePoint
Do you agree with them all? Are we missing some?
Let us know what you think.
-
Never touch production environment with SharePoint
designer.
- SharePoint designer can silently reformat your code and introduce errors.
- If you modify any masterpage or pagelayout file with SharePoint designer, it becomes
ghosted. This means that SharePoint is now looking at a customized version stored
in the database rather than the version on the file system. You then can't deploy
changes using SharePoint solutions & features.
*Note: Moved to
http://sharepoint.ssw.com.au/Standards/SoftwareDevelopment/RulesToBetterSharePoint/Pages/ProductionEnvironment.aspx
-
Developers should work on all custom webparts in their own
SharePoint development environment.
This is to prevent their work affecting other developers. Sort of things you can
expect to happen:
- IIS resets need to be done frequently, which stops the SharePoint website working.
- Custom webparts can easily introduce memory leaks which can stop SharePoint working.
*Note: Moved to
http://sharepoint.ssw.com.au/Standards/SoftwareDevelopment/RulesToBetterSharePoint/Pages/CustomWebparts.aspx
-
Make small incremental changes to your VSeWSS projects.
- When working on packaging SharePoint artefacts into Features & Solutions, you should
always make small incremental changes to your VSeWSS projects. Each time you should
build & deploy to check you haven't broken anything.
- You should regularly make labels in TFS so you can quickly compare your changes
against previous working versions to identify problems.
*Note: Moved to
http://sharepoint.ssw.com.au/Standards/SoftwareDevelopment/RulesToBetterSharePoint/Pages/ChangeVSeWSSProjects.aspx
-
Customize your SharePoint webparts.
Try to customize existing out-of-the-box SharePoint webparts before you roll your
own.
*Note: Moved to
http://sharepoint.ssw.com.au/Standards/SoftwareDevelopment/RulesToBetterSharePoint/Pages/CustomizeYourSharePointWebparts.aspx
-
Do you know to develop inside a VM?
All SharePoint customization and development must be done on a Virtual Machine.
No ifs, no buts.
- It's very important to correctly setup a SharePoint environment for development.
Correctly configured, this will save you a lot of trouble later on.
- From time to time, you can seriously screw/damage a SharePoint installation during
development and it is best not to install SharePoint on your day-to-day machine.
- Additionally, when you start a new SharePoint project you don't want to carry all
the baggage from previous customizations that could potentially affect your new
project.
There are many other benefits of using a virtual machine for development
- Virtual machines can be fired up and shut down easily
- Virtual machines can run faster, via being located on a different server and thus
it doesn't waste developers' own computer resources
- Virtual machines can be copied and brought to a client for demonstration or testing
- They are the best way to quickly test or experiment with something new
- Bad: There might be more work required to activate additional servers
- Bad: You need at least 2 GB of RAM
If you are after a clean, pre-configured SharePoint server image to test SharePoint,
the easiest way is to
download a trial VM from Microsoft
More info on setting
up SharePoint VM
*Note: Moved to
http://sharepoint.ssw.com.au/Standards/SoftwareDevelopment/RulesToBetterSharePoint/Pages/CustomWebparts.aspx
-
SharePoint version?
When your SharePoint website was built successful, you need to create SharePoint
version to let users know what version is it

More info on better code
*Note: Moved to
http://sharepoint.ssw.com.au/Standards/SoftwareDevelopment/RulesToBetterSharePoint/Pages/SPVersion.aspx
-
Work with SharePoint designer.
- Don't use inline CSS
- Always put <div class="..."> wrappers around SharePoint controls. This allows
us to define styles for SharePoint controls. It is possible to use CssClass like
ASP.NET, but then we lose control to SharePoint regarding how that control will
be rendered.
- Naming convention for control id! Don't get lazy.
- Turn off Auto indent.
*Note: Moved to
http://sharepoint.ssw.com.au/Standards/SoftwareDevelopment/RulesToBetterSharePoint/Pages/WorkWithSPDesigner.aspx
-
Do you always use Site Columns instead of List Columns?
A site column is created on a site level and visible to all lists and content types
within that site (and subsite).
- New in SharePoint 2007 (WSS v3)
- The same column can be added to different Content Types, lists, list templates
- Allows you to make modifications at one place and SharePoint can apply the changes
for you across the different lists and content types (doesn't try to fix the content
for you though)
- More visibility of the customization we are applying to the SharePoint website
- Make sure the site column is added to our own group description such as "SSW Columns"
*Note: Moved to
http://sharepoint.ssw.com.au/Standards/SoftwareDevelopment/RulesToBetterSharePoint/Pages/UseSiteColumns.aspx
-
A Favicon is a small image file included on nearly all professional developed SharePoint
sites. The Favicon reflects the look and feel of the SharePoint site or the organizations
logo.
-

-
Figure: Good Example - Using the favicon gives your SharePoint site a very professional
look and feel.
-

-
Figure: Bad Example
Internet Explorer ("IE") 5.0 and above has a function that, if someone bookmarks
the page, It will look for favicon.ico from the directory of the web page, if not
found it will look for it from the root directory of the SharePoint site. Otherwise
it will use the default Icon.
To implement the favicon:
- Copy your company's .ico icon to the root of the site and rename it to favicon.ico
-
Add the yellow code between the <HEAD> tags in your MasterPage.master (or
regular HTML/ASPX page)
Note: If you put the icon with the default file name of favicon.ico in the root
directory of your domain, you don't need to add the following code. Because each
time your Web page is added to a user's favorites, Internet Explorer automatically
searches for this file from the root directory and places the icon next to all the
favorites and quick links originating from your site.
|
<head runat="server">
<title>Coogee Australia - Self catering self contained holiday accommodation,
water views, close to beach</title>
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<link href="http://www.ssw.com.au/ssw/Include/ssw.css" type="text/css"
rel="stylesheet">
<link rel="shortcut icon" href="~/Style Library/SSW/favicon.ico"
type="image/x-icon" />
</head>
|
Figure: One line of HTML lets you add your company's icon to your web page
For more information about the shortcut icon, check out msdn.microsoft.com
We have a similar rule in
Rules To Better Websites - Graphics
We have a program called SSW Code
Auditor to check for this rule.
*Note: Moved to
http://sharepoint.ssw.com.au/Standards/SoftwareDevelopment/RulesToBetterSharePoint/Pages/SPSiteFavicon.aspx
Acknowledgements
John Liu