Skip Navigation LinksHome > SSW Standards > SSW Rules > Rules To Better SharePoint

Do you agree with them all? Are we missing some? Let us know what you think.
  1. 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
  2. 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
  3. 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
  4. 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
  5. Do you know to develop inside a VM?

    All SharePoint customization and development must be done on a Virtual Machine. No ifs, no buts.

    1. It's very important to correctly setup a SharePoint environment for development. Correctly configured, this will save you a lot of trouble later on.
    2. 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.
    3. 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

    1. Virtual machines can be fired up and shut down easily
    2. Virtual machines can run faster, via being located on a different server and thus it doesn't waste developers' own computer resources
    3. Virtual machines can be copied and brought to a client for demonstration or testing
    4. They are the best way to quickly test or experiment with something new
    5. Bad: There might be more work required to activate additional servers
    6. 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
  6. SharePoint version?

    When your SharePoint website was built successful, you need to create SharePoint version to let users know what version is it

    SharePoint Version
    More info on better code

    *Note: Moved to http://sharepoint.ssw.com.au/Standards/SoftwareDevelopment/RulesToBetterSharePoint/Pages/SPVersion.aspx
  7. 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.
      Uncheck Auto indent

    *Note: Moved to http://sharepoint.ssw.com.au/Standards/SoftwareDevelopment/RulesToBetterSharePoint/Pages/WorkWithSPDesigner.aspx
  8. 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"
      SSW Columns

    *Note: Moved to http://sharepoint.ssw.com.au/Standards/SoftwareDevelopment/RulesToBetterSharePoint/Pages/UseSiteColumns.aspx
  9. Does your SharePoint site has favicon?

    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:

    1. Copy your company's .ico icon to the root of the site and rename it to favicon.ico
    2. 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 You are going to a site outside of SSW

     

    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


Benefit from our knowledge and experience!

SSW is the industry leader in Custom Software Development, Software Auditing & Developer Training.

Call us on +61 2 9953 3000 or email us for a free consultation

What does it cost? I’m not in Australia. Can you still help?