CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Jeffrey Palermo (.com)

Blog moved to www.jeffreypalermo.com

A software "build" is a lot more than just compiling the solution - level 200

Many developers don't use source control and don't use any automated tools.  This is extremely inefficient and troublesome.  Those on teams are forced to use source control in an effort to share the latest code with all members of the team.  In the source control environments, there is a tacit agreement not to commit any code to the repository that will break the build.  If the build breaks, it hinders the velocity of the other developers on the team because they cannot move on while the build is broken.

What does "build" mean?
Some folks use the term "build" to mean compile, and that is incorrect.  On the teams that use no automated tools, the compile might be the only step in their build process, but the two are still different.  The "build" is a process of taking the source of a software system and making it ready for deployment.  Some teams will manually compile the source and stop before deploying to a development environment.  These teams are short-changing themselves because the only feedback they've obtained about the current bits is that there are no syntax or linking errors.  There is no verification that any part of the software functions as intended.  Next, they may manually perform some steps to get all the bits and configuration in order to deploy the system to a development environment.  Then after some manual testing, they've obtained some level of feedback.

Let's compare the above with an Agile build.
Here are some steps that are often performed in the build process of an Agile team - these steps are always automated so they run fast and are repeatable:
  • update latest code _and dependencies_ from source control.  (automated process will get latest code from the SCC repository)
  • compile solution (standard compile and link)
  • copy application files to test location (output binaries moved to location to prep for automated testing)
  • run automated unit tests. (automated tests produced through TDD or otherwise - give immediate feedback on the state of the system)
  • automated environment setup to prepare for an integrated test of the system
  • run integration tests. (gives even more feedback that the integration points of the system are functioning correctly - might include a database)
  • run regression tests (if you have them - verifies that all past functionality is still working as before - this is a type of integration test)
  • tag source control with build number if successful (only tag successful builds - discard unsuccessful ones)
  • Notify development team members of success or failure
Some teams add more steps depending on their needs, and some teams don't have integration or regression tests suites yet.  Each build process should be developed by the team and tailored to the system.  The above are some of the more common steps that Agile teams include in a build process.

The point of an automated build process is to transform the current code into a working system and get feedback on the current quality as fast as possible.  If the entire process is fast, you will run it often and obtain feedback often.  If it's slow, you won't do it often.  The only requirement for the developer is to start the build.  Many Agile teams even automate that step by having a program kick off a build after every commit to the SCC repository.  That process is called "Continuous Integration". 

At the end of a build, the team should be confident that if they deployed these bits to an environment, it would work.  There still may be bugs discovered, but they are confident that old bugs haven't resurfaced and the system works at least as good as it did on the last build.  The extra testing steps in the build process ensure that the state of the software is always moving forward.  Without these steps, developers have no way of knowing if a change broke an existing feature.

Feedback is key in a build process.  The team should decide what steps can be added to the build process to generate as much feedback as possible.  My team recently inherited a system with a build duration of 25 minutes.  This is way to slow for us, and our initial goal is to reduce that duration to 10 minutes.  We'll be able to do this by emphasizing fast unit tests more and doing away with some of the really slow integration tests (that have delicate, cumbersome data setup scenarios).

Tools my team uses in our build process:
  • Subversion (source control)
  • CruiseControl.net (build runner and tagger - keeper of the builds)
  • CCTray (system tray notification of successful or failed builds)
  • NAnt (Xml scripting format to describe steps to be run during the build)
  • NUnit (automated test harness)
  • .Net SDK (includes compiler and linker)


Comments

-e said:

I was just wondering - are you doing any work with 2.0 yet? I'm trying to get my head around the tradeoffs between Nant (which doesn't support 2.0 solutions) versus MSBuild (which handles solutions nicely, but doesn't really handle any of the othew build tasks). What are your thoughts?
# January 17, 2006 10:07 PM

Jeffrey Palermo said:

Eric,
Yes, I'm doing a lot of work with .Net 2.0 as well as .Net 1.1. I started with 2.0 at Beta 1 and currently have two projects on the RTM and 1 project on .Net 1.1.

With 2.0, you'll need to <exec /> from NAnt to MSBuild to compile and link the solution. You'll also need to <exec /> aspnet_compiler.exe to precompile ASP.NET websites.

The MSBuild team claims the same level of functionality, but for me that's not feasible because I need more than the usual file copy and running of unit tests. I need targets to link into Subversion to get the latest code, and I like the NUnit2 task.

They may be pretty comparable, but unless MSBuild just blows away NAnt, I'll stick with NAnt. It's simple and has everything I need (and it's easy to <exec /> to any other utility I need).
# January 17, 2006 10:29 PM

Jason Haley said:

# January 18, 2006 8:17 AM

Jason Haley said:

# January 18, 2006 8:20 AM

Rob said:

I have some questions. I'm working at a relative small company
doing ASP(.NET) development with specialized Content Management
Systems from different vendors.

These projects typically run for 1 or 2 months before the site is
delivered to the client. Is it workable and a good idea to setup such
a complete build system in such cases as well?

How do you handle build numbers in such webcases? Do you update
AssemblyInfo.cs to new build numbers, or? What about Visual Basic 6
(which we unfortunately still have to use with some clients)?

Everything is in sourcecontrol (sourcesafe at the moment) so we've
at least got that part covered.

I always have a feeling that these practices are more geared towards
library or application development than web development.

Do you include the Visual Studio projects files in sourcecontrol? If so,
how do you handle that when multiple people are developing?
As you need write access to the solution files when working on your
project, and only one person can check out. If you don't store it in
sourcecontrol how do you handle changes to project settings?

Thanks for any thoughts on these matters

p.s. I'm not yet familair with the new .NET 2.0 MSBuild or nAnt model,
so perhaps that is no longer an "issue". We are still on 1.1 and VB6
# January 18, 2006 10:42 AM

Jeffrey Palermo said:

SCC systems _cannot_ compensate for communication within a software team. Communication is essential to working as a team.
# January 23, 2006 9:49 PM

Fregas said:

Ok, so I understand what all those tools do, with one exception Nant.

What does NAnt do for me? What is its purpose?

Thanks for this article. I really didn't understand the compile vs. build difference that deeply.
# January 24, 2006 5:45 PM

Brian Brewder said:

Great article. I've helped set up my company's build process and have to say that an automated system can definitely improve quality in terms of consistency of the build (people would always miss steps when ran manually) as well as catching problems sooner so it is easier for developers to pinpoint exactly what went wrong. The difficulty of finding a particular build problem is a function of the amount of code, number of developers that have checked in code, and the amount of time the code has been checked in (most people can only remember a finite number of things).

One of the issues that we had run into is that we have a lot of projects (over 100 and growing) that make up our application (it's an ERP product). In order to compile the projects in the correct order without having to burden the developers with configuring the build process I developed a way to sort them automatically.

If anybody is interested in this process I have written a Code Project article on the subject (Compiling Multiple Projects Without a Solution - www.codeproject.com/.../Project_Build_Order.asp). It describes how to create an MSBuild project by reading the references defined in the vbproj files.

We use FinalBuilder to automate our build. It allows you to visually configure your build. Unless you are a full time build engineer, I would definitely suggest this route. I've blogged on this topic if you are interested (Making the Build  - brewder.blogspot.com/.../making-build.html).

# October 13, 2007 10:45 AM

About Jeffrey Palermo

Jeffrey Palermo is a software management consultant and the CTO of Headspring Systems in Austin, TX. Jeffrey specializes in Agile coaching and helps companies double the productivity of software teams. Jeffrey is an MCSD.Net , Microsoft MVP, Certified Scrummaster, Austin .Net User Group leader, AgileAustin board member, INETA speaker, INETA Membership Mentor, Christian, husband, father, motorcyclist, Eagle Scout, U.S. Army Veteran, and Texas A&M University graduate. Check out Devlicio.us!

Our Sponsors

Free Tech Publications

This Blog

Syndication

News

Headspring Systems

View Jeffrey Palermo's profile on LinkedIn

See my new blog at .jeffreypalermo.com