Jeremy D. Miller -- The Shade Tree Developer

Sponsors

The Lounge

News

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Using Continuous Integration? Better do the "Check In Dance"

So you're making the move to install a Continuous Integration process on your project.  Most of your early attention is going to be spent on getting the CI server up and the build scripts put together and functioning.  That part of the process in the .Net world is getting easier as the tools have matured and the accumulated knowledge available online has multiplied.  My company is moving to full blown CI and TDD on our main systems soon.  Other than getting migrated off of VSS, I'm not too worried about the infrastructure setup.  What I am worried about are the developer practices. 

One of the key practices in agile processes is Collective Code Ownership.  Collective ownership can make a project team much stronger, but there are some inconvenient side effects in coding construction.  Because agile iteration work is mostly scheduled by business need and not by what is convenient for us the developers, it's not unusual for two or more active coding threads to be simultaneously changing some subset of the code.  The idea of continuous design* implies that even big architectural changes can be happening on an ongoing process.  The key point is that things are changing and that can be risky.  CI is one of the enabling processes that supports both continuous design and collective ownership, but you've got to take advantage of it.  The CI build process is a mechanism to find and eliminate problems from code changes as early as possible.  The key for developers to get the most out of CI without being burned is to be disciplined about their "Check In Dance."

Basic Guidelines

  • Check in as often as you can.  Try to reach stopping points as often as you can.  This goes back to the basic agile philosophy of making small changes and immediately verifying the small change.  When you're doing Test Driven Development you strive to keep "Red Bar" periods as short as possible.  The same kind of thinking applies to code check-ins.  Make small changes and see the impact on the rest of the code immediately.  Merging code will be less painful the more frequently a team integrates their code.
  • Avoid stale code.  If you have to keep code out for any length of time, make sure you are getting everyone else's changes.  Try really hard not to keep code out overnight.  If you're using shared developer workstations, put some sort of sign on the workstation that there is outstanding code on the box.  I've seen several XP zealots swear that they'll throw away any code left overnight.  Personally, I think that's just a silly case of "I'm more agile than thou," but it's still a bad idea to leave code out overnight if you can help it.
  • Don't ever check into or out of a busted build.  Checking in might make it harder to fix the build because it will cloud the underlying reason for the build, and you can't really know if your changes are valid.
  • Communicate and negotiate check in's to the rest of the team.  Frequently the complexity of a merge can be dependent upon who goes first.  Some teams will use some kind of toy as a "check in token" to ensure that there is never more than one set of updates in any CI build.  Pay attention to what the rest of the team is doing too.
  • If you're working on fixing the build, let the rest of the team know.
  • DON'T LEAVE THE BUILD BROKEN OVERNIGHT.  That's also an occasional excuse to your wife on why you're home late from work.  Use with caution though.
  • Not every member of the team needs to be a full-fledged "BuildMaster," but every developer needs to know how to execute a build locally and troubleshoot a broken build.  If you're suckered into being the technical lead, make sure every team member is up to speed on the build.

 

The "Check In Dance"

The best practice for effective CI is to perform the integration on a developer workstation before that code escapes into the build server wild.  It's okay to break the build once in awhile.  One of my former colleagues used to say that the CI build *should* break occasionally just to know it's actually working.  What's not okay is to leave the build in a broken state.  That slows down the rest of the team by preventing them from checking in or out.  Even worse, somebody might accidentally update their workstation with the broken build and get into an unknown state.  If you follow these dance steps, you can minimize build breaks and run more smoothly.  Besides, it's embarassing to have the "Shame Card" on your desk.

  1. Let the rest of the team know a change is coming if it's a significant update.
  2. Get the latest code from source control. 
  3. Do a merge on any conflicts.
  4. Run the build locally and fix any problems found.
  5. Commit the changes to source control.
  6. Stop coding until the build passes.
  7. If the build breaks, drop everything else and fix the build.

Here's a tip on annoying the crap out of your teammates.  I found a MIDI file of the "Chicken Dance" song one time and commenced playing that out loud everytime I checked in.  It was funny for about a day or two.

 

* I detest the term "Emergent Design."  That term makes it sound like you just spit out a bunch of code like a new age painter randomly splattering paint on a canvass and voila -- a coherent design will spontaneously create itself.  When I worked with the High Priests of Agile, I used to frequently get chewed out and told to "just let the design emerge."  To this day I have no earthly idea what that means.  I think it means just write lots of "it/then/else" statements until the code practically screams for restructuring, then have a big, heated hullabaloo meeting to agonize about the proposed refactoring.  Agile processes can be just as stupid as any CMM-driven waterfall if you're not thinking straight.


Posted 07-25-2005 3:03 PM by Jeremy D. Miller

[Advertisement]

Comments

Jeffrey Palermo wrote re: Using Continuous Integration? Better do the "Check In Dance"
on 07-25-2005 6:42 PM
These are some great tips. I use them at work all the time.
Christopher Steen - Learning .NET wrote Link Listing - July 25, 2005
on 07-25-2005 8:57 PM
Ajax.NET for Microsoft ASP.NET 2.0 (beta)
BackgroundWorker and Web Services
Data Source Controls...
Christopher Steen - Learning .NET wrote Link Listing - July 25, 2005
on 07-25-2005 9:00 PM
Ajax.NET for Microsoft ASP.NET 2.0 (beta)
BackgroundWorker and Web Services
Data Source Controls...
Christopher Steen - Learning .NET wrote Link Listing - July 25, 2005
on 07-25-2005 9:00 PM
Ajax.NET for Microsoft ASP.NET 2.0 (beta)
BackgroundWorker and Web Services
Data Source Controls...
rsakalley wrote re: Using Continuous Integration? Better do the "Check In Dance"
on 07-25-2005 10:59 PM
While I am not a full fledged follower of Agile, (Emergent Design being one of the major reasons for that) especially for long term projects, I feel Emergent design is like letting a horse run within the circular wooden boundary. If you fail to define these, I think more things would break than make. So defining the boundaries is a must, and then let the developers loose, for the micro level emergent design, which actually comes out of TDD and Refactoring, nothing more nothing less. This may keep improving your macro level design, or may not.
Jeffrey Palermo wrote re: Using Continuous Integration? Better do the "Check In Dance"
on 07-26-2005 5:59 AM
Emergent design. All the developers have to be very skilled for that to happen. So many programmers get things working and are content with crap that works. Agile assumes that the team consists of motivated, capable people. To do Agile development, you have to have the people first.
Jeremy D. Miller wrote re: Using Continuous Integration? Better do the "Check In Dance"
on 07-26-2005 6:58 AM
Ranjan, I really only meant to avoid the extreme of "emergent" design. I would never support a BDUF approach. I prefer Jim Shore's description of "Continuous Design" (http://www.martinfowler.com/ieeeSoftware/continuousDesign.pdf). The key in my mind is to be thinking about the design and trying to improve every single day. Our development practice is still much closer to XP than something like RUP, and it works for us. I just think the zealot, purist approach to XP can be stupid. Design philosophy is a full range of approaches, not a binary switch, and there are plenty of folks out there doing XP and Agile well.

Regardless of approach, you're gonna want skilled developers that are working responsibly. NO process or design technique will ever change that fact. To Jeffrey's point, you really want the full team to be responsible for design or at least participate. If your developers need to be "coralled" you're already screwed out of the gate.
Colin Kershaw wrote re: Using Continuous Integration? Better do the "Check In Dance"
on 07-27-2005 3:04 PM
I think Bill had a great post that addresses the all too often overlooked focus on People:

http://www.williamcaputo.com/archives/000069.html

"In short," as he says, "... non-agile ... views process as having a larger impact on a project's success than its people...".
Jeremy D. Miller wrote re: Using Continuous Integration? Better do the "Check In Dance"
on 07-28-2005 3:10 PM
Thanks for the link Colin. Good to hear from you.
Jeremy D. Miller -- The Shade Tree Developer wrote Yes, but CruiseControl.Net and its ilk are still important
on 08-22-2005 12:23 PM
James Shore has been running a series of somewhat controversial posts about continuous integration. ...
Jeremy D. Miller -- The Shade Tree Developer wrote Slides from the Continuous Integration Talk Last Night
on 09-20-2005 8:36 AM
As promised, here is a zip file of the slides from last night's Continuous Integration talk.  I...
Jeremy D. Miller -- The Shade Tree Developer wrote Slides from the Continuous Integration Talk Last Night
on 09-20-2005 9:54 AM
As promised, here (EDIT:  fixed link) is a zip file of the slides from last night's Continuous Integration...
Jeremy D. Miller -- The Shade Tree Developer wrote Slides from the Continuous Integration Talk Last Night (With Fixed Link)
on 09-20-2005 11:00 AM
As promised, here is a zip file of the slides from last night's Continuous Integration talk.  I...
on 03-29-2006 11:26 PM
I had one of those days today where you spend a hurtful amount of time just waiting for something to...
Jeremy D. Miller -- The Shade Tree Developer wrote Best of the Shade Tree Developer (with actual links!)
on 08-07-2006 4:50 PM
Between being extremely short handed at work, tech' reviewing a new book, a
possible book proposal...
Jeremy D. Miller -- The Shade Tree Developer wrote Best of the Shade Tree Developer (with actual links!)
on 09-01-2006 2:32 PM

Between being extremely short handed at work, tech' reviewing a new book, a possible book proposal

Jeremy D. Miller -- The Shade Tree Developer wrote My Gameplan for Starting a New Project from Scratch
on 10-02-2006 4:10 PM

I'm starting my new job today and kicking off a new project this week. The organization is relatively

Jeremy D. Miller -- The Shade Tree Developer wrote Getting Started: How often should you check in?
on 11-07-2006 7:43 AM

Yesterday my team was talking about how often the CruiseControl.Net build ran each day. The question

Silver Stripe Blog » Blog Archive » Twenty five posts on agile wrote Silver Stripe Blog » Blog Archive » Twenty five posts on agile
on 01-08-2007 3:28 AM
Jef Patat wrote re: Using Continuous Integration? Better do the "Check In Dance"
on 05-25-2007 4:46 AM
Chad Myers' Blog wrote Starting a new set of projects, what to do?
on 10-29-2007 3:58 PM

Starting a new set of projects, what to do?

Jeremy D. Miller -- The Shade Tree Developer wrote Resources from my DevTeach talks
on 11-29-2007 12:03 PM

To everybody that attended one of my talks at DevTeach this week. All of the materials are now online

From the software development trenches wrote Continuous Integration: From Theory to Practice
on 12-03-2007 3:08 PM

Continuous Integration (CI) is a popular incremental integration process whereby each change made to

Kyle Baley - The Coding Hillbilly wrote Review of the Check-In Dance
on 07-06-2008 9:50 PM

This started as a promotion for the dimecast I recently did on the Check-In Dance but I think it's

Community Blogs wrote Review of the Check-In Dance
on 07-06-2008 10:43 PM

This started as a promotion for the dimecast I recently did on the Check-In Dance but I think it's

Slava Imeshev wrote re: Using Continuous Integration? Better do the "Check In Dance"
on 08-14-2008 6:04 PM

Nice post. Here is another collection of best practices that we have accumulated over years: www.viewtier.com/.../continuous_integration_benefits_challenges_best_practices.pdf

Alex wrote re: Using Continuous Integration? Better do the "Check In Dance"
on 08-25-2008 11:34 AM

I'm into a Continuous Integration process and it's a total nightmare. Unluckily I inherited the project so there's little I can other than being patient and find out why the h*ll isn't the workspace compiling today.

I agree with you when you say that most of the time, the CI process becomes the real goal and people forget that we are here... to design and write software. Not just be cool and say "wow... it's integrating continuously!!!"

As for the Emergent Design... well... people believing in ED may also believe to Santa Claus. If what you need to acheive is a frontend-somebackend-database project it may sound likely the design grows up itself. For serious enterprise projects, analysis and design are mandatory practices before ANY line of code is actually written.

Jeremy D. Miller wrote re: Using Continuous Integration? Better do the "Check In Dance"
on 08-25-2008 11:41 AM

But yet Alex, my team and I are happily able to do emergent design on a daily basis.  Some design before coding, sure.  All of it? No way.

Dale Smith wrote re: Using Continuous Integration? Better do the "Check In Dance"
on 09-04-2008 12:28 PM

Three years on, and it's still an amazingly relevant post.  I just forwarded the Check In Dance and a link to this post to one of my coworkers who has not quite learned the joy of keeping the build clean.

Community Blogs wrote Jeremy's Other Laws of Continuous Integration
on 09-22-2008 9:16 PM

Since the first one inevitably irritated people, let's go for rule #2 & #3: 2.) Check in as often

Mirrored Blogs wrote Jeremy's Other Laws of Continuous Integration
on 09-22-2008 9:53 PM

Since the first one inevitably irritated people, let's go for rule #2 & #3: 2.) Check in as often

Jeremy’s Other Laws of Continuous Integration - taccato! trend tracker, cool hunting, new business ideas wrote Jeremy’s Other Laws of Continuous Integration - taccato! trend tracker, cool hunting, new business ideas
on 10-06-2008 5:06 PM

Pingback from  Jeremy’s Other Laws of Continuous Integration - taccato! trend tracker, cool hunting, new business ideas

Outdoor Activities wrote Outdoor Activities
on 10-07-2008 12:32 AM

Pingback from  Outdoor Activities

RasmusKL's Blog wrote Reducing Check-In Friction (in Continuous Integration)
on 01-11-2009 3:43 PM

Reducing Check-In Friction (in Continuous Integration)

Jimmy Bogard wrote Transactions and the check-in dance
on 03-05-2009 9:28 AM

At our current project, I’m on the largest individual team I’ve ever worked for.  I’ve been in larger

Daniel Teng wrote Back to Agile Basics: Continuous Integration 持续集成
on 06-14-2009 11:16 AM

周六在博客园的做了一个关于敏捷开发的讲座

Add a Comment

(required)  
(optional)
(required)  
Remember Me?