March 2005 Entries

Today was the day that we have training at the DotNet Solutions. Dr. Neil Roodyn has presented eXtreme Programming techniques and technologies that we can simply implement in our day to day development tasks.

The most interesting thing that the belief to "Zero Defect Software Product" which I believe was impossible. At the end of the training I actually had to change my decision on this. Also the courses that I am taking this semester "Requirements Elicitation & Analysis Techniques and Verification and Validation Techniques" at ANU is also taking this belief into account and introducing  tools to accomplish this.

Test driven development (or test first development) plus Continues Integration makes us (SW developers) more agile in a sense that we can deliver a software product which will fulfil the customer's requirements from the zero iteration of our product. Dr. Neil Roodyn's book is starting from chapter 0 so the first iteration in your software development effort becomes "Iteration 0". Iteration 0 is where you get all your tests are passed and you are fulfilling the most important features for the customer.

Design Patterns also mentioned in the training. The result is; you should not squeeze your code into design patterns but the patterns should come out of your code. If there is an emerging design pattern at some part of your code then you may think of it getting done as a pattern more accurately.

Pair Programming was the fun part. We sit down as pairs, one is the coder the other is the observer. After coder finished his/her work, observer gave a grading out of 10 and told what he/she liked and what he/she didn't like about it. Based on the comments the code has been fixed. The result is a better code which will result in a quality product later on. This is also called perfection game. Pair Programming is an issue for most of the developers as everybody's personality and psychology is different. You can get a greater view about Pair Programming from Laurie Williams' book "Pair Programming Illuminated"

Planning game was also another fun part. We have written down the customer requirements on cards and spread them on the floor in front of the customer and asked him to prioritize most important features. Based on this you are defining what is actually required or what are the features that you need to deliver in your first release or iteration.

Test first development has raised some questions like "Why do you write test first?" the answer is because tests are becoming your specifications to write the code. The other question was "Why is it costing more?" the answer was because you are lowering the maintenance cost while you are raising the development cost.

Re-factoring was the last thing that we have done. It is restructuring the code while maintaining the behaviour to understand the code more, making it more robust, making it easy to add new features and lowering the cost of change.

I think it was an informational training but I was expecting more hard core XP rather than introductory things on eXtreme programming.

Thanks to DotNet Solutions and Dr. Neil Roodyn to provide us this training. Ah also MSDN Connection for the discount.

Dr. Neil Roodyn

[Listening to: ForThoseAboutToRock - AC-DC - ACDC Live (7:08)]

This is a bit more enhanced list

 

Project Management
MasterListXL (free)

IDE
MS Visual Studio .NET 2003
Sharp Develop (free)
Web Matrix (free)

UML
ArgoUML (free)
MS Visio 2003

Patterns
DOF Design Patterns (free)
MS Patterns Practices (free)
MS Application Blocks (free)

Source Control

Visual Source Safe (at work)
Subversion (free)
TortoiseSVN (free)
AnkhSVN (free)

WebSVN (free)

Continues Integration
CruiseControl.NET (free)

Automated Compile
NAnt (free)
NAntContrib (free)

Utilities
Reflector (free)
Reflector AddIn (free)
CodeSmith (free) (Pro is not)

Unit Test
NUnit (free)
NUnit AddIn (free)
TestRunner for NUnit  (free)
NUnit ASP (free)
NUnit Forms (free)

NCover (free)

 

Performance tests

ACT (comes with VS.NET EA)

NProf (free)

Code Analyse
FXCop (free)
FXCop AddIn (free)

Documentation
NDoc (free)

Libraries
Logidex.NET (free)

Cruise Control is a continues integration software for build and deploy operations. It will check your source control server in defined intervals and will download & compile the projects if there is a modification on them. It will also inform stakeholders about the outcome of the compile. Cruise Control can use other open source projects like NUnit, NAnt, NCover, FXCop and will work with most of the source control servers available.

I will explain the part "how the Cruise Control will work with Subversion". You need to install Subversion first, create a database and some users, use Margus's service wrapper to run Subversion as a Windows server. First, necessary applications you need to instal:

  1. Subversion version 1.1.3
  2. NAnt version 0.85 rc2
  3. NAntContribute version 0.85 rc2
  4. NUnit version 2.2.0
  5. Visual Studio .NET 2003
  6. Notepad2 (to edit XML config files)
  7. TortiseSVN (no need to struggle with command prompt)

NUnit has an easy to use installation. NAnt and NAntContrib is distributed as zip files. Unzip them and copy the NAntContrib/bin folder content into NAnt/bin folder. This way NAnt can use the tasks in NAntContrib. Also add the NAnt/bin folder to Environment Variables/Path so the nant.exe can be called from any directory.

You will be needing IIS as well to check the log records. Make sure that default.aspx is defined as the default document when you create a virtual directory.

I have used .NET Framework 1.1 and build scripts are created based on 1.1 framework. NAntContrib and NAnt versions are important. If they are not the same version, you may not be able to call NAntContrib tasks. NUnit version is also important. It should be 2.2.0 otherwise you need to fiddle with "binding redirections" in test config files.

First of all we will create a C# file that is compilable with NAnt. Once this is working we will hand over everything to Cruise Control. Copy paste the below code into Notepad2 and save it as BestCode.cs into CCExample folder.

        using System;

        //\CCExample\BestCode.cs

        namespace KruyzKontrol {

        public class Gurkan

        {

            static void Main(String[] args)

            {

                Console.Write("CC Example is working");

            }

        }

        }

Try with csc if it is compiling successfully. Now, we will create an NAnt build script to compile. Again, copy & paste the below xml script to Notepad2 and save it as cruise.build into the same folder where your BestCode.cs is.


<?xml version="1.0"?>

<project name="CCExample" default="build" basedir=".">

   <description>any description</description>

   <property name="debug" value="true" />

   <property name="defaultframework" value="net-1.1" />

   <target name="build" description="Compiles the code">

  <csc target="exe" output="BestCode.exe" debug="${debug}">

          <sources>

             <include name="BestCode.cs" />

          </sources>

      </csc>

</target>

</project>


\CCExample\cruise.build

Open a command prompt to the folder where your BestCode.cs is and enter the NAnt command below. We will test if the NAnt is actually compiling our code.

D:\Workbench\CSharp\Deneme\>nant -t:net-1.1

You should see an output telling you that the compile is successful. If there are errors, check the messages and try to correct them.

NAnt will search for a .build file in the folder and when it found, will compile the source based on the data in the .build file. -t parameter is superseding the old parameter -defaultframework and used to indicate that we want to use Framework version 1.1. Check the outputs and make sure the compile has done. There must be one executable and a debug file (.pdb) in the folder.

Now use TortoiseSVN and send the project to Subversion. I have Subversion working with svn: protocol so I can access to my Subversion server with svn://Yoda or I can use IP address of the machine YODA which is svn://192.168.0.1 . Do not forget to create a folder for the project like svn://Yoda/DotNet/CCExample/

Now this is where the pinatas' tail has dropped. We need to get the Cruise Control to do this for us. After you extract the zip of Cruise Control go into the "server" directory. You need to create a file called ccnet.config in this folder containing the xml below. This file will tell the ccnet.exe, what to do.


<cruisecontrol>

<project>

    <name>CCDeneme</name>

    <webURL>http://Yoda/ccnet</webURL>

    <triggers>

        <!--<intervalTrigger seconds="30" buildCondition="ForceBuild"/> -->

        <intervalTrigger seconds="30" />

    </triggers>

    <sourcecontrol type="svn">

        <!--<executable>c:\program files\subversion\bin\svn.exe</executable>-->

        <executable>svn.exe</executable>

        <trunkUrl>svn://Yoda/DotNet/CCDeneme</trunkUrl>

        <workingDirectory>D:\Workbench\CCDeneme</workingDirectory>

        <username>gurkan</username>

        <password>gurkanpass</password>

        <autoGetSource>true</autoGetSource>

    </sourcecontrol>

    <build type="nant">

        <executable>D:\OpenSource\NAnt\bin\nant.exe</executable>

        <baseDirectory>D:\Workbench\CCDeneme</baseDirectory>

        <buildArgs>"-D:svn.executable=c:\program files\subversion\bin\svn.exe" -t:net-1.1 </buildArgs>

        <buildFile>cruise.build</buildFile>

        <targetList>

            <target>build</target>

        </targetList>

        <buildTimeoutSeconds>300</buildTimeoutSeconds>

    </build>

    <publishers>

        <xmllogger>

            <logDir>D:\OpenSource\CruiseControl\web\log</logDir>

        </xmllogger>

    </publishers>

</project>

</cruisecontrol>


Please refer to the Cruise Control documentation for further explanation. Basically, we have a project that is on Subversion and we want to compile with our NAnt script. We also want all the outputs to be recorded in a log folder.

Create a folder under CruiseControl\Web directory and name it as "log". Find the file web.config under CruiseControl\Web and open with Notepad2. Locate the line below:

<add key="logDir" value="log" />

And change it with this one:

<add key="logDir" value="D:\OpenSource\CruiseControl\web\log\" />

Next step is to create a virtual directory in IIS for the CruiseControl\web folder. You may leave all the default settings but make sure the default.aspx is in the default documents.

Now looks like everything is ready to run the ccnet.exe for our first automated compile\integration. Open a DOS prompt to CruiseControl\server directory and run the ccnet.exe. It will use the ccnet.config file and will check the Subversion to see if there is any change on the project. If there is, it will download the project and compile. Every 30 seconds it will check the Subversion again. To trigger the compile, download the project from Subversion with TortoiseSVN to a different directory and make a change. Send the project back to Subversion with TortoiseSVN and keep an eye on the DOS window that the ccnet.exe running.

It is time to see the outcomes on Internet Explorer. Browse to http://localhost/ccnet/default.aspx.

Another way to be notified about the compiles is CCTray application. It is under CruiseControl/CCTray directory. You may copy this folder to another computer on the network to get notifications about the compiles. Run the CCTray.exe and enter your Cruise Control server URL. You should be able to select your project from the drop down list. My settings are:

Server : tcp://YODA:21234/CruiseManager.rem

Project Name: CCExample

If you are accessing the Cruise Control server from another computer on the network, use the IP address or machine name instead of localhost.

What we have accomplished so far:

  1. Created a project which can be compiled with NAnt.
  2. We have written ccnet.config to get the connection between Cruise Control and Subversion.
  3. CCNet.exe is now controlling the Subversion source control.
  4. When there is a modification on the Subversion, it has been picked up and compiled.
  5. We can see the results from web.
  6. CCTray.exe notifications are working.
What about NUnit Tests

It would be good if we can run the NUnit tests on this project and see the results on Cruise Control web page. You may give a break to ccnet.exe. We will first integrate NAnt and NUnit. When we get a successful test, we will try to see the test results on Cruise Control.

This time create a Visual Studio class project and add a reference to NUnit.Framework assembly. Modify the class1.cs to look like the below code.

using System;

using NUnit.Framework;

namespace KruyzKontrol{

    /// <summary>

    /// Summary description for Class1.

    /// </summary>

    [TestFixture]

    public class Class1{

        public Class1(){

            //

            // TODO: Add constructor logic here

            //

        }

        [Test]

        public void FailTest(){

            Assert.Fail("This test will fail and CC will show the message to me");

        }

    }

}

Save the project somewhere else (other than CCExample folder) with the name Test and send it to Subversion with TortoiseSVN under CCExample\Test.

We will have some modifications on the cruise.build file to integrate with NUnit tests. We need to clean up the test folder if exist, download NUnit test project from Subversion, compile both test project and BestCode.cs and execute the tests. When we get everything up and running, we will handover the process to Cruise Control and sit back & relax. Below is the modified version of the cruise.build file.


<?xml version="1.0"?>

<project name="CCExample" default="build" basedir=".">

<record name="Buildlog.txt" level="Info" action="Start"/>  

    <description>any description</description>

    <property name="debug" value="true" />

    <property name="defaultframework" value="net-1.1" />

    <target name="build" depends="get">

        <csc target="exe" output="BestCode.exe" debug="${debug}">

            <sources>

                <include name="BestCode.cs" />

            </sources>

        </csc>

        <solution configuration="debug" solutionfile="Test\CCTest.sln" />

        <nunit2>

            <formatter type="Xml" />

            <test assemblyname="Test\bin\debug\CCTest.dll" />

        </nunit2>

    </target>

    <target name="get" depends="clean">

            <svn command="checkout"

             uri="svn://Yoda/DotNet/CCExample/Test"

             destination="D:\Workbench\CCExample"

             username="gurkan"

             password="gurkanpass"

             verbose="true"/>

        </target>

  <target name="clean" >

            <delete dir="Test" failonerror="false" />

        <mkdir dir="Test" />

        <delete file="BestCode.exe" failonerror="false" />

        <delete file="BestCode.pdb" failonerror="false" />

   </target>

   <record name="Buildlog.txt" action="Close"/>

</project>


<URI> is the Subversion folder where your test project resides.

<DESTINATION> is the working directory for the test project.

There are multiple targets in this one and they are dependant to each other. First the "clean" target will clean up the existing folders, "get" target will download the test project from Subversion, "build" target will compile the projects and execute the NUnit tests. Open a command prompt to the project folder and enter the below command.

D:\Workbench\CSharp\Deneme\>nant -t:net-1.1

If you are seeing an error message saying that build failed, then everything is okay. This is what we want. Now we may handover the process to Cruise Control. Run the ccnet.exe and browse to http://localhost/ccnet/default.aspx. Check the builds and see the error message that we have setted in the code.

This is the re-publishing of the original on my MSN Spaces blog

8:30 - 9:30 Keynote - Microsoft Technology Update

The introduction was given by Ben English. Ben talked about the state of the Net from a security point of view and explained What is the Microsoft's approach to that. The subjects were Awareness & Education, Technology and Partnership.

Ben English - Security Lead at Microsoft Australia

Andrew Cunningham - Product Manager for Exchange, ISA & Management Server

After the introduction, Raj Natarajan presented Windows Server 2003 Service Pack 1 and explained how to lock up Win2003 Server by disabling some services which are not needed during the setup of Service Pack 1. He also mentioned SUS (Software Update Service) becoming WUS (Windows Update Service). WUS is still beta but eventually will replace SUS in future.

Also all the update services like Windows Update, MS Download, VS Update are consolidated in one service called Microsoft Update, we will not be needing to visit different update sites to install patches and things when it is implemented. I couldn't get a photo of Raj, he was sort of hiding behind the counter.

9:30 - 10:30 - MSDN Track - Visual Studio Team System Overview

I have hanged with MSDN Track series in Murray Room in National Convention Centre. Those presentations were more developer related after all. Prashant Sridharan presented how the productivity increases with Visual Studio 2005 and the Visual Studio Team System. VS2005 Beta2 will be released this quarter. VS Enterprise Architect and VS Enterprise Developer is also merging into Team System 2005. There are 3 versions of Visual Studio. These are VS Team Architect, VS Team Developer and VS Team Test. The bottom VS Team Foundation is sold separately and will not be included in MSDN Subscription . Basically we developers need the VS Team Developer version and Visual Source Safe is still available.

VS Team Foundation will be installed onto a dedicated Windows 2003 Server with .NET Framework 2.0 and SQL Server 2005. All the check-ins and check-outs will be made over this configuration. It is not using Visual Source Safe in any manner. It is a completely new system. SDLC tasks like workitem tracking, task creation and follow-up, document management, source control, reporting, change management eg will be on this platform. There are also MSN Messenger and Outlook plug-ins will be made available with code to integrate VS Team Foundation with these tools. When you create a project on VS Team Foundation it also creates a SharePoint site for it to make it easy collaboration so another requirement on the box is the SharePoint server.

It also integrates with Excel and MS Project for item tracking and project management. The tools that we use as open source like NProf, NUnit, NAnt are all have equivalents in VS2005 but I am not sure if they are as functional as open source counterparts. I felt in love with the Web Services architecting design tool. You can design Web Services as boxes, define inputs outputs and the structure for it will be ready to code. I was thinking the future of software development when I was in uni and this is actually what I imagined.

VS Team System also provides you with the software development methodologies to comply with. The only available option in beta version is "MSF Agile" which will give you some of the deliverables of Agile Methodology. The other option is "Formal Process Guidance", this is CNMI Level 3 (I hope I spelled correctly) compliance. There is also a Process Guidance editor to tailor what is available or to create new ones.

The hint to get the VS Team System with low prices is to get the MSDN Subscription now. As they are promising to release the VS Team System this year end of September, you will get it in MSDN Subscription. MS will increase the prices of MSDN subscription after this release date.

Prashant Sridharan - VS Team System Product Manager

And Finula Crowe

11:00-12:00 - Tools For Quality Code

Nigel Watson and Sean Salisbury has presented tools to write quality code. Nigel presented FxCop and other code quality tools which are exist in VS2005. Sean presented Compuware products such as Security Checker. They are nice products and helps to deliver a secure, quality code. In VS2005 you can also define policies for check-in operations like "if the code did not pass unit test, do not check-in" or "if the code did not pass security check, do not check-in" so you will make sure that the code in Source Control is secure and unit tested.

Sean Salisbury from Compuware

Nigel Watson - MS Australia

1:00-2:00 - Design for Operations

David Lemphers and Nigel Watson has presented this one. They have talked about DSI (Dynamic Systems Initiatives), Systems Definitions Model, Application Connection Design, Logical Datacenter Designer. I don't remember much but it is basically designing the architecture in a way to support easy development of it.

David Lemphers from TeamForce

2:00-3:00 - Source Control and Work Item Tracking

Prashant presented this one. He talked about Check-In policies, Unit Test, Code Analyzes, Code Coverage and mentioned about the Shelving and Unshelving. Basically, when you finish fixing a bug you are uploading your code into a shelf then you are creating a review task for your colleague to review your code. You colleague given access to the shelf to download your code when you create a review task. After review he or she uploads the code and you can continue from there. Much like branching with more flexibility.

You can manipulate work items from Outlook, MSN Messenger, Excel or MS Project; there is one for every type of person. There are companies writing tools for VS Team System for these purposes.

3:30-4:30 - ClickOnce Deployment

Andrew Coates gave a very nice presentation of how we can deploy the Windows Forms applications painlessly on to the client's computer. With VS Team System you can publish your Windows Forms application on a Web Server and you can send the link to the customer to install it. When there is a new version available you only publish it in the same way and application picks-up the new version and installs it on to the client's computer. Application checks if there is a new version available before it shows first form to the user. Client can revert back to an old version through Add Programs wizard.

Also you can use System.Deployment namespace for a menu option in the application to check if there is a new version.

Andrew Coates - Developer Evangelist

4:30-5:30 - Intro to SQL Server 2005 Programming

Greg Low presented new features in SQL Server 2005. The best part was SQL Server and CLR integration. Basically you can use SQL Server 2005 as a host for the CLR so CLR thinks that the operating system is SQL Server 2005. It is weird isn't it. You can install an assembly into SQL server, it becomes part of SQL Server and call it's functions from Query Analyzer. T-SQL, ADO.NET also enhanced. There are many functions added to T-SQL like Row_Number(), Rank(), Dense_Rank(), NTile() and also full support for user defined types and functions.

You can download the presentation and the code from www.sqlserver.org.au.

Greg Low

Conclusion

This is one of the most productive and informational day for me. I have got lots of idea about the new products, how to use it, what do I need to install. I am also looking forward to go to the Code Camp which you can get info from www.codecampoz.com

Search



About me

Hi, my name is Gurkan Yeniceri. I am a software engineer with 8 years of experience in both public and private sectors. I have been generally writing about software engineering and Microsoft technologies since March 2005 on this site.
View Gurkan Yeniceri's profile on LinkedIn

Contact

If you would like to contact with me you can use the contact page here. I will try to respond it in a timely manner (I will try my best). You can also contact with me via Microsoft Live Messenger with the address gyeniceri {AT} hotmail {DOT} com.
If you are one of my Turkish readers, you may want to visit my Turkish blog here.

If you would like to read my site with an RSS reader like RSS Bandit, you may want to use to subscribe.

RSS 2.0

Advertisement


Bookmark this site

del.icio.us digg NewsVine YahooMyWeb Reddit Spurl TailRank BlinkList Furl Shadows blogmarks
    www.flickr.com
    This is a Flickr badge showing public photos from gurkanyeniceri. Make your own badge here.
    There are 133 posts and 88 comments on this site. Other sites also linked it 7 times.

    Advertisement