HOME  |    TRAINING  |   FREE TUTORIALS   |   JOBS
Find out more about our new RSS feed.
FREE Tutorial
BEGINNING E-COMMERCE PART 4 - VERSIONING

CATEGORY
SEARCH OUR OTHER TUTORIALS

DESCRIPTION

When we make the site available to visitors we'll deploy (copy across the ASP code and ActiveX components) the application to a Web server at a remote location. At this point one of the things that can cause a lot of hassle is not knowing for certain whether the software components we're running are the correct ones.


This free tutorial is a sample from the book Beginning E-Commerce: with Visual Basic, ASP, SQL Server 7.0 and MTS.


Put it this way - say you identify a problem with a component on your site. During a round of testing and development you create a new component that addresses the problem that you duly deploy to the remote server. Now when you come to test, the bug appears to still be there. The question that runs through most developers' heads at this point is "Is the code the correct version?"

Well, Microsoft does a really neat job of hiding most of the internals of ActiveX away from us, so in order to determine if IIS (the Server we intend to deploy to)) is loading the right component we have to start digging through the Registry. Even if all that appears to be in order, we still can't see inside IIS to determine if it's doing something odd. We then can't be confident that our next step in solving the problem is the correct one.

One of the quickest and easiest ways to address this problem is through versioning. Since the beginning, Windows has put functionality into its development tools that lets developers tack version numbers onto the end of any DLL, EXE or OCX.

For example, if you open up Windows Explorer and find a DLL or EXE on your system, then right-click on it, choose Properties, and change to the Version tab, you should see something like:

In this example, which is one of Microsoft's MFC runtime DLLs, we can see the version number that the developers tacked onto the end of the file to identify it; in this case it's 4.21.7022.

The three parts making up this number are, in order, termed:

  • Major Number
  • Minor Number
  • Revision

Thus in our example the major number is 4, the minor 21 and it's revision 7022. The major and minor numbers usually stay fixed throughout a development project. So, if six months after we've deployed Jo's Coffee we need to do some maintenance work, we will probably choose to increase the minor number. If we need to do a serious overhaul of the code, we will probably choose to increase the major number.

For day-to-day deployment and testing, we'll usually increase the revision number (sometimes called build number). The very first component we deploy will have a revision number of 0. The second will be 1, and so on.

It's a good idea to do include versioning information with our DLLs, but we should make sure that each time we compile a new version of the DLL for deployment we have to change the version number.

Try It Out - Setting the Original Version Number

1. You can use VB's Project Properties dialog to set the original version number of the project. Select Project | WroxCommerce Properties and change to the Make tab:

You can see on the dialog that there are three boxes, one for each of minor, major and revision. There's also a Version Information box that you can use to set other information on the DLL, like copyright information, product information and such like. Referring back to the MFC DLL Properties screenshot, you can guess that, if we change that information here, users of Windows Explorer will be able to see the values we set when they bring up the file's properties.

We can ask VB to automatically increment this revision number for us each time we make (or compile) the DLL by ensuring Auto Increment is checked on.

2. As we are just starting out on our project set Major to 1, Minor to 0, and Revision to 0 and close the dialog.

An Aside - Obtaining the Version Number

Once we're confident in our versioning strategy, we can make our business object DLLs tell us their version number by querying a property on the root object in the model.

Programmatically checking the version number of DLLs on your system is actually quite tricky. For this reason, we're going to build properties into our Visit object that we can use to quickly find the version number of our business object DLLs.

To do this, all you have to do is ask the Visit object for it's Major, Minor, and Revision numbers, like this:

' Version - returns the version number back...
Public Property Get Version() As String
Version = App.Major & "." & App.Minor & "." & App.Revision
End Property

In our Version property, all we've done is taken those three numbers and mangled them into a string, like this: 1.0.0. We'll see this approach in action later on.

As you'll see later, we can, when required, build a very simple ASP page that lets us keep our head while all around are losing theirs. Just by querying a single page on the server, we can see if we are using the correct version of the component. The code that we'll eventually use to achieve this aim is:

<%
 ' create an instance of the site...
 Dim Visit
 Set Visit = Server.CreateObject("WroxCommerce.Visit")

 ' get the version number...
 Response.Write "Version: " & Visit.Version

 ' stop the site...
 Visit.ShutDown
 Set Visit = Nothing 
%>




5 RELATED COURSES AVAILABLE
I-NET+ MODULE 13 - E-COMMERCE
On completion of this module, readers will be able to understand e-commerce terms and concepts.....
HTML 4.0 INTRODUCTION
To create, format and publish a small website using HTML 4.0. You will learn to create web pages incorporating fo....
MACROMEDIA DREAMWEAVER MX INTRODUCTION
To give an introduction to the Internet tools and features of Macromedia Dreamweaver MX. Readers will create an a....
MICROSOFT INTERNET EXPLORER 6.0 INTERNET INTRODUCTION
This course provides readers with an introduction to the concept of the Internet and the opportunity to gain a br....
A+ MODULE 5 - THE INTERNET
At the end of this course you will be able to: describe the functions of an operating system, describe the featur....
 
0 RELATED JOBS AVAILABLE
CONTACT US
Tuesday 22nd May 2012  © COPYRIGHT 2012 - website design by Website Design by Visualsoft