Name of the blog

Short description of the blog

Using PureCM to Develop Websites

The problem

PureCM was originally designed to help software developers work together to share their code and facilitate parallel development. The last ten years has seen a huge rise in web development which brings with it new ways of working. Although PureCM can be used to store any type of data, if not set up correctly web developers might feel they are fighting against PureCM to work the way they want. This blog outlines some of these different ways of working and how PureCM can be set up to complement them.

Multi-User Workspace

SCM best practices will always advocate having a private workspace where the developer can work independently of his/her colleagues. You choose when to incorporate their changes by updating your workspace – controlling when your work is impacted by other people. You choose when to publish your changes by submitting a changeset – controlling when your colleagues work might be impacted by yours.

In the real world, however, it is not always possible for developers to have private workspaces. This is especially common for web developers where each developer can’t have his/her own version of the website running on their machine. It is therefore not unusual for all web developers to work on a single website on a development server where they all share the same files.

PureCM handles this situation well with multi-user workspaces. An administrator creates a workspace on the development server, the same as creating a private workspace but specifying not to store the workspace in the home directory. Each developer then creates a workspace in the same location, again specifying not to store the workspace in the home directory.

PureCM will automatically recognise that a workspace already exists and will reuse the same workspace. Developers will only see the files they are working on in ‘My Changesets’ (as if they were working within a private workspace). But if another developer checks a file out, the file will become locked to all other developers within that workspace. This stops different developers modifying the same files.

 

 

Another area PureCM is improving on is handling non-text based files. While software developers predominantly work with text-based files, a web developer will be much more likely to work with image files and other non-text based files. For the 2008/3 Release PureCM provides support for image viewing and diffing. So developers can see what changes they have made to an image file before submitting.

Not Working in Visual Studio or Eclipse

The majority of software developers use Visual Studio or Eclipse to write applications. Although web developers can use either of these IDEs it is much more common for them to use an alternative IDE. If the IDE doesn’t support the SCC API then the developer has 2 choices; manually checkout a file in PureCM before working on it, or create a writable workspace.

Manually checking out a file becomes very time consuming and is often not practical. If you do a search and replace for a string in 200 files you do not want to go and checkout each file manually. The alternative is to specify that a workspace is writable when creating it.

Now all the files in the workspace are writable – so you can edit them without having to check them out. When you need to submit your edits, run the ‘Check Consistency Wizard’ on the workspace to work out which files have been edited/added/deleted. For convenience you can also enable the ‘Check Consistency before Submit’ option in the Tools | Options | Submit page. Note that this option is client specific, so every developer has to define it for himself.

With this enabled, PureCM will automatically check for edits before every submit. So when you want to submit your work you just press the submit button in your workspace and PureCM will check which files have been changed and launch the ‘Changeset Dialog’ so you can check your changes and then submit.

Websites as Streams

PureCM’s streams based approach is most effective when developing multiple versions of a product simultaneously (parallel development). Typically websites follow a single code path. So why use a powerful tool like PureCM to develop websites?

Firstly most website development involves at least 2 code lines – the development stream and the live stream. So if your web developers manually upload the files they have been working on to the server, they are effectively merging a changeset from the development stream to the live stream. It is not uncommon for web developers to also have intermediary QA (or integration) streams.

In a traditional approach the development and live web sites are on the same server as illustrated here:

In a quality approach the development and live web sites are separated onto different servers:

PureCM will support either approach by using development and live streams. This process will be a lot less error prone (and a lot quicker) if the developer submits the change to the development stream. The change can then be merged to the live stream using the PureCM Resolve Tool and the Web Deployment Server (see below) can then automatically upload the files. PureCM will ensure developers are not treading on each other’s toes.

Another feature our web developer customers have found useful is components. It is typical for a web development company to be developing/maintaining many different websites which share code. So when a bug gets fixed in the shared code they want it applied to all the websites. This is exactly what PureCM components are for. Select a folder in a stream and share it in another stream as a component. The contents of the folder can be changed in either stream and the change will be reflected in the other stream. The PureCM Knowledge Base has lots of articles on when to use components and how to set them up.

Deploying a Website

When a software developer wants to make a new build he/she creates a new release stream, creates a workspace for the release stream on a build machine using PureCM and starts the build process. It is not a problem that PureCM is running on the build machine.

Deploying a web site however is typically a much more secure operation. The web server will typically be tightly controlled with an administrator overseeing exactly which applications are installed on it.

Also, changes to a web site are often uploaded on a daily basis. You do not want the inconvenience of having to go to the web server to update the workspace after every upload.

This is why we are introducing the Web Deployment Server in the 2009-1 release. The web deployment server runs on a separate machine where the PureCM client is installed. It runs as a service listening for submits. When a change is submitted the new files are uploaded to the web server via FTP/SFTP. So PureCM is not installed on the web server and changes are uploaded to the live web site automatically.

What if you want to control which changes are uploaded to the live server and when? You create a separate stream for the live web site. It is only when the product manager merges changes from the development stream to the live stream that they get uploaded to the live web site. Also if you want to rollback a change you can simply rollback the changeset in the development stream and merge it into the live stream.

2009-1 Release and Beyond

With rich internet applications and cloud programming the distinction between a web developer and an application developer is becoming less and less clear. Combined with the increasing adoption of agile development practices, the way developers work is changing dramatically. PureCM is evolving to support these practices with flexible features which support many different ways of working, i.e. offering a future proof solution! A good example of this is the new perspective based GUI.