Archive for the ‘Tips and Tricks’ category

What’s a Manager to Do? Management’s Role in Scrum Organizations, Part III

March 15th, 2010

I love the concept of self-managing teams.  Everyone figures out what needs to be done, and does their best to make the greater organization successful.  Beautiful.  Reminds me of the Shaker Village, the Russian Artel, or the Israeli Kibbutz.  All of which are (largely) extinct today.

There are three structural problems that, like termites behind the wallpaper in a French Quarter house, cause these “worker’s paradises” to fail.  Our job, as managers of the Innovation Engine, are to sniff ‘em out, expose them, and exterminate them.

Problem #3: The Buck Starts Here.

For all the happy talk about mission, values, and meaningful work, the ultimate metrics for business are financial.  Our inability to grow, make profits, secure new investors, etc., will ultimately end our ability to accomplish our missions, support our values, or provide work to our employees and worse yet, ours bosses. That’s the bad news.

The good news is that we managers can use money (or their engineering equivalents, people) to accomplish great things.  Which things we choose to accomplish is largely up to us.

No, that doesn’t mean we want to create our own user stories, and reprioritize the backlog to meet the requirements communicated to us in our sleep by our deceased pet snake.  That’s the product owner’s job.

The Scrum process, like its Lean predecessors, is based on incremental improvement.  That’s great for two reasons: first the changes are small enough that we can get them done and see the results before the environment has changed, and second because they are small enough in scope that the individuals in development or product management can understand and control them.

We managers have to see the bigger picture, and that generally means determining the funding level for each of the initiatives we have.  Adding people to a team will eventually, not withstanding our bad management, increase its velocity.  Pulling people off will generally do the opposite (although not as quickly as you might think …….).

The optimization problem for the overall success of the organization involves lots of variables, but that’s really why they pay us the big bucks.  Is this group servicing a stable and productive customer, while this other group is struggling to overcome a mountain of technical debt?  Are competitors starting to emerge for what has been a stable area? Has this project achieved most of its goals? Is it time to determine what should be the next big initiative?

The purely business and marketing side of the equation is usually an area of influence, not control, for the development manager.  But the assignment of resources to projects is the execution of that strategy, and requires management comprehension and “buy-in.” For those of you uncertain, the term “buy-in” refers to agreeing to do something you’d really rather not do at the risk of losing your job.  It’s been around a long time, but has flourished in the recession.

On the technical side, there are important funding issues to consider.  One of the biggest is the effect of architecture on the overall success of projects.  Studies have demonstrated that one of the biggest factors in ROI for IT initiatives is the quality of the underlying architecture.  Should you add features to your Windows XP app, re-write it to run on an i-Phone, or re-write it to run within your CRM system?  Big questions with lots of impact both in the short term or long term.

Conclusions

Senior engineering management is a tough job with many tasks and responsibilities, too numerous to list here, but including team dynamics, people management, strategic funding decisions, and golf at expensive resorts.  Middle management has similar responsibilities, without the golf.

Great organizations are rarely the product of good luck.  Great leadership recruits the right people, puts them in the right roles, identifies problems and fixes them, and looks ahead at trends to make sure resources are assigned to the right places.

In Scrum, this doesn’t require a lot of managers, but does require of lot from managers.  Empowering managers to act, and ensuring that they do, is critical to the long-term success of your Agile organization.

What’s a Manager to Do? Management’s Role in Scrum Organizations, Part II

March 12th, 2010

I love the concept of self-managing teams.  Everyone figures out what needs to be done, and does their best to make the greater organization successful.  Beautiful.  Reminds me of the Shaker Village, the Russian Artel, or the Israeli Kibbutz.  All of which are (largely) extinct today.

There are three structural problems that, like termites behind the wallpaper in a French Quarter house, cause these “worker’s paradises” to fail.  Our job, as managers of the Innovation Engine, are to sniff ‘em out, expose them, and exterminate them.

Problem #2: PURE – Previously Undiagnosed Recruiting Errors

My old boss used to tell me there were three kinds of programmers.  Those smart enough to do the job, those too stupid to do the job, and those that could do the job but don’t care to.  Well, that’s not exactly the words he used, but this is a family blog.

None of us is the perfect recruiter, and every once in a while people get through the screening process that we’d rather have work for Al Qaida.

The incompetent developer (which we managers code name “moron”) is not always the one who takes the longest to do a story.  If some developers generally take longer than average to complete a story, they may be “slow” (as my grandmother would have put it) or the estimates may be dominated by optimists.  Until you’re measuring the amount of rework created by bugs found in QA (and the field), you really won’t know.

That doesn’t mean you don’t have to take action: managers have been acting on intuition since the Donner party decided to try the Sierra Nevadas in the winter of 1846.  Sometimes it’s better to eat the mule than have the whole group starve.

As engineers we tend to focus on technical proficiency, but there are some things which are hard to judge in an interview.  Like whether a developer has good judgment of when to refactor and when to patch.  Or whether a developer can embrace process changes or will struggle for weeks with the changes.  Or whether a developer has that certain combination of personality traits that make their coworkers doodle pictures of poisons, weapons and torture devices.

Now finding the sociopath may be more difficult than you think, because they’ve cleverly chosen to hide out amongst programmers, most of whom act as though still carrying scars from middle-school.  Like a submerged rock in the river, sometimes they can best be detected by the havoc they leave in their wake.

Developers generally treat managers using the same rules the Mafia use with the DA: no matter how much we loath our co-workers, we’re not going to rat them out.  One-on-one meetings with group members can give some indication of problems.  A few tactful questions at retrospectives may give some clues to underlying issues that aren’t being discussed.

Try inviting the group to try a little pair-programming and see what pairs get put together, and who threatens to quit.

Finally, the toughest people management issues are when good performers drop off.  Often this is a temporary fluctuation which just requires some coaching: do they need some customer visits to increase motivation, maybe a chance to learn some new technology they can apply, or sometimes there is a transient personal problem that just needs a little extra time.

Often, establishing expectations with people of what needs to be improved and then giving them a little time to do so is just the right prescription.  They may need mid-course correction and coaching to improve.  They might just need a supportive shoulder, or a swift kick in the pants, but the combination of communicating the issue, establishing higher expectations, and providing support is a good combination for improving performance.

Unfortunately, persistent decreases in performance are usually like that oil leak under your car every morning: they indicate there’s more going wrong than you thought, they’re probably going to get worse, and if untreated the future isn’t going to be pretty.

The most common mistake I see in my conversations with engineering management is the “conflict avoider.”  We’ve all made excuses about how long we need to wait to see if the situation can improve, how hard it is to find new talent, how much training time and ramp-up it is going to take to get a replacement up and productive.  And don’t forget the ‘ole disempowering “I can’t make a change in the middle of the project!”

These are just excuses. We owe it to both the team and the company to accept our mistakes, make the changes, and get on with building a better future.  That’s what we get paid to do.

What's a Manager to Do? Management's Role in Scrum Organizations, Part I

March 4th, 2010

I love the concept of self-managing teams.  Everyone figures out what needs to be done, and does their best to make the greater organization successful.  Beautiful.  Reminds me of the Shaker Village, the Russian Artel, or the Israeli Kibbutz.  All of which are (largely) extinct today.

There are three structural problems that, like termites behind the wallpaper in a French Quarter house, cause these “worker’s paradises” to fail.  Our job, as managers of the Innovation Engine, are to sniff ‘em out, expose them, and exterminate them.

Problem #1: “No, you can’t have a BB gun until you’re older.”

Scrum was the solution to product and project managers trying to both predict the future and over-control senior development talent.  Take away the control freak, and we can all let our hair down. We can do what we always knew was right.

Unfortunately, it’s hard to keep a team like that together forever.  The world is a fast changing place, people leave, new people are hired, some are inexperienced, and some good people become more interested in keeping their teenager off drugs than in completing user stories in your ERP system.

Can’t say I blame them, but this isn’t a welfare agency here, and we’ve got to get work done.

Teams, like individuals, have different levels of motivation and different levels of competence.

Let’s imagine that you’d never been on a sailboat before, but decided to try a cruise in the Caribbean aboard a 63’ Sloop (whatever that is).  I’ll bet you’re expecting the captain to train you to do some pretty straightforward tasks, and make sure they’re done correctly.

How’d you feel if the captain shook your hand and walked off onto the pier?

Some years ago, before the One Minute Manager had made him too rich to worry about such things, Ken Blanchard realized that there were different management styles appropriate for different situations.  He (and Hersey) created the Situational Leadership model to map effective leadership styles to different situations.  The most effective leadership style for a group of people who are Capable + Motivated to complete a task is delegatory: set up the process and let them turn the crank.  Sounds like Scrum!

Now not every team gets to work on Avatar.  Somebody’s got to fix that potato peeler code running on the mainframe, and that somebody just might be you.  If you’ve got a team of people who feel like they only get the projects no one else will take, who don’t have a lot of experience with the code and think it’s pretty badly written, and maybe haven’t been out of college long enough to have the wonderful motivation of monthly mortgage payments, that “hands off” style won’t get a lot of productivity.

This comes under the general heading of “coaching”, and some of us are better at it than others.  If you couldn’t figure out why your kids couldn’t learn to ride a bike while you were holding it, if you describe design ideas as “brain dead”, or if you think emailing a link to the manual is a substitute for training, then coaching might not be for you.

And coaching applies to team dynamics, too.  Sometimes the reason senior people didn’t go into management is because they have their own social challenges.  These senior types might not play well with others, and might need a little counseling, if not metal detectors, to keep the atmosphere professional.

Some philosophers think people are inherently good, and bad behaviour comes from social organization.  Some philosophers think people are inherently selfish and bad, and good behaviour comes from compliance with social organization.  My wife hasn’t told me what I think yet, but as managers we are responsible for making sure team members have the coaching and motivation to be successful.

Using a Perl Debugger with Server Side Triggers

July 31st, 2009

By Wayne Blair, Senior Consulting Release Engineer and Development Facilitator

Introduction

This article describes a method to use a perl debugger on trigger scripts without advanced interprocess debugging tools.

Using a perl debugger with a V4.x server side trigger launched by the server is very difficult and encounters two known obstacles:

  1. The server will fire the trigger and the debugger will run in a thread of the detached server process; the debugger will start but will probably not communicate with you. However, if you manually started the server via a shell command then the perl debugger will start, accept input from the keyboard, then you will loose contact with the debugger; it does not have exclusive access to the keyboard because it is running in the context of the detached server process. The next command you type will go to the shell, not the debugger.  It gets messy from there.
  2. Debugging on your live server means another AccuRev command could launch the same trigger in debug mode and the AccuRev client that issued the command will appear to be “hung” because the server thread for that command has called the debugger.  Also, if you started the server from the shell command, you will now have two debuggers trying to communicate with you. Running two different triggers in debug mode will create madness for you and get your users very upset!

Summary

  • Trigger parameter files facilitate communication between the server process and triggers.
  • The AccuRev server does not provide a mechanism to preserve trigger parameter files; they are temporary and removed.
  • XML is used for most trigger parameter files but some still use flat files. Study the original trigger to know how to process the format.
  • Modify the trigger file to capture and preserver the trigger parameter files. There can be many parameter files per transaction. Compose the file name based upon the trigger name, sequence number, and epoch second.
  • Practice continuous process improvement! Use a semaphore file to activate and deactivate the feature to capture the parameter data to a file. You will enable the feature for a few minutes to collect samples then disable it.  The semaphore allows you to reuse the feature without editing the trigger script.
  • Once you have enabled the facility and have collected a few trigger parameter dump files, choose an interesting one and make a copy; the copy step is important because the trigger you are debugging will reinitialize the trigger parameter file to return data back to the server. NOTE: Some triggers expect both an XML and flat parameter files. Study the trigger to determine the correct calling arguments.
  • Use the copy of the parameter file and pass it as a command line parameter to the trigger you run with a Perl debugger.
  • You can now single step through your trigger.
  • You must make a new copy of the original parameter file before restarting the debugging session because the file you passed into your trigger was reinitialized. You do not need to exit the debugger, just make a new copy of the trigger file before you issue the debugger “R” (restart) command.

Details

I extend AccuRev functionality to support development processes and I create complex triggers that are easier to develop with a Perl debugger; this is especially true when your triggers are manipulating issue tracking data.  The AccuRev CLI manual provides good information about the triggers but you might need subtle details that are beyond the scope of the documentation. Walking through trigger execution with a debugger gives details about the content of the parameter files and what is passed from trigger to trigger.

I am not aware of any special options to allow the AccuRev server to run Perl triggers in debug mode and my attempts to do so create an unworkable environment. Since triggers are driven by parameter files, I’ve added routines to all the triggers to collect their parameter files. Once I have a collection of interesting parameter files I can launch the trigger scripts with my own Perl debugging tool of choice instead of them being launched by the AccuRev server.  I can also inject faulty data via the parameter file for testing.

The AccuRev server creates a temporary parameter file for each trigger it is calling.  The file name will be a relative path to a temporary directory and each filename will be a sequence number. Please note that a trigger can be fired more than once for a transaction. The temporary file name does not indicate the target trigger script; the trigger name and the AccuRev command that fired the script are embedded in the parameter file.

I embrace the concept of continuous improvement so I anticipate trigger debugging will used many times over the years.  I used a semaphore file to enable and disable the parameter dump functionality to eliminate edits to the trigger scripts on the live repository.  I’ve even attached captured parameter files to issue tickets I’ve submitted to AccuRev support.

Capturing Parameter Files

The AccuRev server determines what trigger to launch then creates one or more temporary files in the cache directory of the site slice and passes a relative directory name and file name(s) in the argument list to the trigger. The server process will ensure a unique sequence number when multiple threads launch the same trigger at the same time.

The steps I use are:

  1. Set up my environment:
    1. Define the semaphore file name
    2. Define a directory below the accurev root to store the trigger parameter files.
  2. Immediately after the trigger has parsed the XML data, call a utility function and pass it the “hook” name and the relative path to the temporary trigger parameter file that was created by the server. The server created file name will be a sequence number.
  3. The utility function will look for the semaphore file in the AccuRev root directory and will simply exit when not found. When the semaphore file is found, the function will compose a unique file name based upon
    1. The trigger “hook” name
    2. The  server supplied file name (minus the directory)
    3. The current epoch second
  4. The utility function will create the trigger dump directory as needed, create the file name composed in step #3, and write the trigger parameter data to the new file.

Appendix A has an excerpt of my server_admin_trig.pl and trigger utility module. I save off the parameter file immediately after the trigger has digested the XML data.

I strive to write my perl code to be operating system agnostic. I keep my common trigger code in a perl module that resides in the accurev “bin” directory. I like to avoid external environment dependencies so I explicitly state the lib path (in an OS agnostic way) to my trigger utility module.  I do this because the “use” is a compile time directive and is processed before variables are defined.

Debugging the Trigger with the Captured Parameter File

You must make a copy of the captured trigger parameter file before you use it. Triggers re-initialize the parameter file to pass data back to the server so your captured data will be lost.

  1. cd $HOME
  2. cp $ACCUREV/trigDumpDir/server_admin_trig-0_0-1246634816   test.dat.org

You launch a perl debugger and pass the trigger parameter file into the script as the first command line argument. Debug to your heart’s content.

  1. cd $HOME
  2. cp $ACCUREV/storage/site_slice/triggers/server_admin_trig.pl    funTime.pl
  3. cp test.dat.org test.dat
  4. perl -d funTime.pl test.dat

NOTE:  The script will reinitialize the parameter file for output. You must copy “test.dat.org” to “test.dat” before you restart the debugging session.

Appendix A:

Server_admin_trig.pl – You can download this script here

Click to download

Click to download

Trig_utils.pm – You can download this script here

Click to download this script

Click to download

Sample of Captured Trigger Data

Below is the trigger parameter file captured from server_admin_trig.pl for a “mkdepot” command.

This is a simple example. The parameter data gets much more interesting when your objective is to mine transaction or issue tracking details.

Capture file name is: /opt/accurev/ar6060/trigDumpDir/server_admin_trig-0_0-1248023869

<triggerInput>
<depot>test10</depot>
<hook>server_admin_trig</hook>
<command>mkdepot</command>
<principal>ar6060</principal>
<ip>127.0.0.1</ip>
</triggerInput>

Hot Backups and Database Verification Without Down Time

June 5th, 2009

By Wayne Blair, Senior Consulting Release Engineer and Development Facilitator

Hot backups are wonderful but one needs two important sanity checks on the backup:

  1. Was this a good backup?
  2. Is the live database okay or did we just backup a corrupted repository?

Unfortunately AccuRev v4.x cannot perform a database integrity check on the running repository so you have to schedule down time but you can run the “maintain” utility on your backup repository on a different machine with a minor change to the acserver.cnf file.

These steps can sanity check both your backup and your live repository at the time of backup without any down time using the behavior of the “maintain” utility.

  1. Write a backup mark using the command “accurev backup mark”.
  2. Replicate your entire accurev installation directory tree to another machine running the same operation system. You want the data, executables, configurations, and license key.
  3. Edit ./bin/acserver.cnf and change the machine name from your live repository to the name of the “other” machine”. MASTER_SERVER = your_other_machine.organization.domain
  4. Run the command “./bin/maintain dbcheck”.

If the command fails due to a host name error then review your edit for faulty white space (the white space before and after the = is required and you must not have trailing white space after the host name).  If the fully qualified name fails, try using the alias (short) name or IP address.

Assuming a successful dbcheck, you have now verified the integrity of your backup and you have verified the integrity of your live repository as of the time of the last backup mark command.

DETAILS

The AccuRev license is tied to a specific host and port number and you must have a different license file to run the AccuRev repository on a different machine.

The maintain utility performs a sanity check on the license and will exit when the license file is missing. It will check on the host name and will exit when the running host name does not match the host in acserver.cnf but will continue to perform the database integrity check when they do match!

My AccuRev server is Linux based so I run an hourly cron job to write the backup mark then rsync the whole installation to another machine.  I intentionally use the –delete option to ensure the backup is identical every time so the edits I apply to acserver.cnf will be eliminated the next time the backup is run.

Here is a trivial sample script to perform the backup with rsync.  I am writing this from memory so please verify the rsync syntax with the trailing slash on the directories.

# ASSUMPTION: ssh keys are already established between this host
#             and the remote host to allow an automatic login.
#
# NOTE: Be sure the previous run of this script has completed before
#       running again.

/opt/accurev/bin/accurev backup mark
sleep 3
rsync -az -e ssh --delete \
/opt/accurev/ \
wblair:/opt/accurev

About The Author

Wayne Blair was invited to contribute to our Distinguished Lecturer Series because of his experience as a consulting release engineer with multiple AccuRev customers.  Mr. Blair has extensive experience creating and extending software development, release, and installation environments, and helping communicate technical information to non-technical people.

Security Primer – Anatomy of the AccuRev Admin Trigger

March 27th, 2009

by Rob Mohr

Do you have the “Admin Trigger” installed and running in your AccuRev environment?  I hope so!

The “Admin Trigger” is the best way for you to restrict those non-ACE’d (AccuRev Certified Engineer) users from wreaking havoc on the process you’ve meticulously designed and implemented for your organization.  Make sure you lock it down!  It’s really simple to do!

Now, I’m not talking about taking flexibility away from your developers, they’ll need to control certain aspects of the process too.  It’s up to you where the line is drawn in the stream hierarchy and the Admin Trigger is the chalk.

The equator is commonly established on the integration stream.  Since the globe in this case is AccuRev, the line of demarcation runs north and south.  To the West (upstream from integration), ACE’rs set the rules on workflow, code promotion, stream configurations, and general access control.  To the East (downstream from integration), developers and development teams are free to make their own decisions to best support their process, products, projects, components, patches, bug fixing and development activities.

Have you read the private prototyping or stream-per-task blogs by Dave Thomas?  These are good examples of how dev teams and developers control how their activities are organized using streams while adhering to the overall enterprise software development life cycle (SDLC).

The Admin Trigger is a simple if-then-else perl script that fires on the server whenever certain commands are  executed.  Out-of-the-box, the script restricts “admin type” commands such as creating users, groups, depots, etc without needing additional customization.

 @cmdlist = qw/mkuser chref chdepot chslice lsacl addmember
                  rmmember mkgroup mkdepot mktrig rmtrig
                  setacl write_schema/;
    # is the user command in the above list?
    if (grep $_ eq $command, @cmdlist) {
    ...

The admin type commands are typically global in nature, meaning, that a single Admin group is granted permission for these commands.  Stream creation has a more granular scope allowing different groups to control their development process and stream management capabilities.

Simply list the streams in the trigger that only Admins have the ability to “manage.”  By default, other streams not listed are managed by the development teams themselves.  There are 2 sections in the trigger to set this up depending upon the commands to control.

Restricts: lock, unlock, chstream, incl, excl, incldo

    $admin_stream{"replace_with_admin_stream"} = 1;
    $admin_stream{"replace_with_admin_stream"} = 1;
    $admin_stream{"replace_with_admin_stream"} = 1;
    ...

Restricts: mkstream, mkws

    $basis_stream_deny{"replace_with_basis_stream_to_deny"} = 1;
    $basis_stream_deny{"replace_with_basis_stream_to_deny"} = 1;
    $basis_stream_deny{"replace_with_basis_stream_to_deny"} = 1;
    ...

Inside the trigger logic, each command is evaluated and will allow the operation to complete or not.

For example, the following section validates the “mkstream” command:

if ($command eq "mkstream") {
...
 # only a user listed as an administrator can create a new stream
 # based on an existing stream in the "basis_stream_deny" list
 if ( defined($basis_stream_deny{$stream2}) and `$::AccuRev ismember $principal "$admingrp"` == 0 ) {
   print TIO "Basing a new stream on existing stream '$stream2' disallowed:\n";
   print TIO "server_admin_trig: You are not in the $admingrp group.\n";
   close TIO;
   exit(1);
  }
}

There are other facilities in AccuRev to control the process and workflow too. Stream Locks grant users/groups the ability to promote to and from streams and Access Control Lists (ACLs) grant access to entire depots and subhierarchies.  Setting up these security measures combined with the Admin Trigger provide your organization with the flexible and granular security model it needs for the optimum development process.

Drop me a note and let me know the creative ways you’re using the Server Admin Trigger.

Getting the Most out of AccuRev’s Windows Explorer Integration

March 18th, 2009

As organizations become more advanced in their use of software configuration managment (SCM) they typically expand its use to include more than the software developers.  A common addition is around audibility and compliance of the entire development process which may require them to version more than just the source code, but also any requirements, project plans, design artifacts and documentation.  This enables the labeling of the big picture of who, what, where, why and how the software was developed.

With this expansion there are now more users of the SCM tools, many of whom have never used a version control solution before. A few examples of these new user types may be hardware designers, graphic designers, product managers, or the documentation team. These types of users are working with different types of files, and work in different tools than the traditional software developers and because of that may use version control tools in different ways.  These users may have historically created versions of files using naming convention such as:

ReleaseNotes_v1.doc, ReleaseNotes_v2.doc etc. all on their local computer.

Obviously this can be an error prone process and also a single point of failure if something were to happen to that user’s computer.  Since many of the files they work on are binary (.doc, .pdf, .ai, .dwg, .vsd etc.) they may want to work on these files in a serial mode so they don’t have to try to manually merge them when someone else makes changes to them in parallel.  So instead of the traditional use of AccuRev, taking advantage of our parallel development features, these users may want to work in exclusively locked workspaces or at least have exclusive locks on certain files to protect them.

In order to make this new type of user successful they need to use an interface that is familiar to them. With many source code control tools they may have to write scripts, manage configurations or interact with a command line interface to be able to get their work done. This type of interaction will likely not work well for these types of users, as many of them may not have the technical know how to work in those environments.  AccuRev can make this transition much more fluid and familiar for these users with the AccuBridge for Windows Explorer. This interface gives the user access to the AccuRev commands needed from within the familiarity of Windows Explorer as seen in exhibit 1.

AccuBridge for Windows Explorer

AccuBridge for Windows Explorer

» Read more: Getting the Most out of AccuRev’s Windows Explorer Integration

Use Case: Fixing the Broken Build

November 4th, 2008

by Rob Mohr, AccuRev

In one of many travels and customer visits, I came across a very cool way that AccuRev was helping to improve the way development teams do their work. To be more specific, this group was using Change Packages integrated with the JIRA Issue Tracking system to manage changes across their various product releases. They also used CruiseControl for continuous integration that would kick off nightly builds and notify the team with the results of the build.

From what they told me, the success of builds has significantly improved since they started using AccuRev because of the ability for the developers to work in their own private workspaces where they can integrate and unit test before promoting their changes for the rest of the team. Although broken builds are, for the most part, a thing of the past, they will still occur once in a while and need to be fixed ASAP.

Here is how they do it with AccuRev

The stream structure below is a simpler view of their overall software development process, but will be sufficient to show the use case.

Promoting to the Integration Stream

To start, the 4 developers below have made changes in their workspaces that will be promoted and associated to 4 different issues.

As you can see below, the integration stream (EntSoft_Client_Int) is “aware” of which issues are active in the stream. These are the new “change packages” introduced in the stream to be included in the next nightly build.

Build Fails in the Integration Stream

The next morning, the team is notified that last nights build failed via an email notification from CruiseControl. They have also scripted CruiseControl to automatically enable a time based stream called the “Temp_Fix_Build” stream and assign the appropriate transaction number to rollback the change packages from last night.

Assign the Developer to Fix the Build

One of the developers creates a workspace on the Temp_Fix_Build and “change palettes” over each change package one at a time.  This gives them the ability to mix and match change packages together to determine which one of them is the problem.

Problem Solved

After the culprit is fixed, the repaired change package(s) are promoted back into the integration stream for all to share.

The AccuRev CLI – Going beyond SCM

October 1st, 2008

By Ryan LaNeve, AVI-SPL

Much has been written on this blog already regarding the ease with which AccuRev allows you to tailor your development process without having to fight with your SCM software. While I could offer yet another account of how simple and straightforward it is to manage our particular process using AccuRev, instead I thought I’d take a few minutes to point out some of the things we’ve done using the tool’s command-line interface and its ability to output results formatted as XML.

Of the various tools we have created over the years, the two we find most useful are what we call “AccuLoad” and “SQL Object Scripter”. The former pulls data out of AccuRev, while the latter puts data into AccuRev. Both were developed in a matter of hours thanks to the extremely intuitive command-line interface which AccuRev provides. Let’s take a closer look at each.

We’ll start with our “SQL Object Scripter”. Anyone whose development efforts involve a database server knows how difficult it is to maintain change logs for the “code” kept within the database. There are a number of “best practices” with regards to maintaining this information within an SCM, but in our experience they are all too time-consuming and involved, which leads to one or more members of the team either forgoing the process due to time constraints or just ignoring the process all together. Maybe we’ve just become spoiled by AccuRev allowing us to work exactly the way we want and otherwise staying out of our way, but we now have a hard time following any procedure which requires us to change the way we do things.

So one day a couple of us sat down and decided to find a new solution. We felt that, at a minimum, what we really wanted was to be able to view changes over time for our database objects, such as tables, views and stored procedures. We knew that if we could just get each change into AccuRev some of our issues would immediately disappear, but we found it too difficult to require the entire team to manually create every script and then manually promote that script into our SCM. We decided that what we needed was a tool that could simply detect changes to our database objects and automatically store those changes within AccuRev. Again, thanks to the simplicity of AccuRev and its CLI, our “SQL Object Scripter” tool was born in a matter of hours. We now have a record in AccuRev of (almost) every change made to any database object we care about, which then allows to use the features of AccuRev to view the history of any object, the differences between any versions of any object and even an annotation of any object to see who is responsible for the make-up of the object. The solution consists of a few parts: a SQL Server table to store DDL change event details, with a DDL trigger on the various databases we care about. The trigger fires whenever a DDL event occurs, such as the creation or alteration of a table, view or stored procedure, and the details of the event get logged to a table. Our custom console app is then scheduled to run every few minutes and checks the table for any records. When a record is found, the console app scripts out the definition of the object to a file and then uses the AccuRev CLI to add/keep/promote the file to our “SQL Scripts” depot – whatever is appropriate depending on whether the object is brand new or pre-existing and has been changed. The AccuRev commands all run within the context of whichever user made the change in the database itself, so all of our AccuRev transactions are associated with the correct team member. While this solution is not optimal and does not provide as much traceability as having each developer maintain and promote database change scripts themselves, we have found it to be an excellent interim solution which was extremely easy to put together.

Another of our tools is the one we call “AccuLoad”. The purpose of this tool is to pull various bits of information out of AccuRev and load that information into a database. We then use the information in the database from several other applications. The tool is a console application which runs in a couple of different modes, but the primary mode is run via an AccuRev trigger. Whenever a promote happens in one of our depots, our custom trigger runs and fires up our console app, passing in a few details such as the name of the depot, the name of the stream and the transaction number of the promote. AccuLoad then takes this information and makes various calls to the AccuRev CLI to gather more details, such as which elements were included in the promote, the version numbers of each of those elements, the user who performed the promote, etc, etc… Additionally, a diff is run against any changed elements, and those details are stored in the database as well. Gathering all of this information from AccuRev was extremely simple thanks not only to the intuitive nature of the functionality exposed by the AccuRev CLI, but also thanks to the option of having the results returned as XML. While I’m sure it would have been possible to create such a tool using any SCM, I doubt we would have ever found the time to do so had we not been fortunate enough to have AccuRev as our SCM. It was, again, only a matter of hours from the time we came up with the idea for AccuLoad and the time our first promotions were being logged in our database.

Having this database detailing the activity in our SCM, we were then able to create several other tools to utilize the information, such as one we call “AccuBrowse”, seen below. This web-based application allows us to browse the database and view any transaction within any stream of any of our depots, and see who performed the promote, the comments supplied during the promote, the elements included in the promote and the differences for any changed element. I should mention that much of this functionality is probably available in the AccuRev Web Interface, though we have not actually used that tool provided by AccuRev. Ours was created a couple of years ago and suits our needs. Beyond just allowing us to browse our SCM history via a web-interface, our database also allows us to perform some analysis, such as frequency of change for elements within a specific depot or stream, which allows to keep tabs on classes within our systems which may have too much responsibility. We can even run queries against the data to find “problematic” code, such as those files most often included in promotions which cause a failed build (not that our builds ever fail, of course…).

In summary, there are a myriad of fantastic features and functionality within AccuRev which make it a great fit as an SCM for any development environment. Once you’ve got your core needs taken care of by the out-of-the-box functionality, I encourage you to explore what can be done with the provided CLI and its XML-formatted output. In our experience, if you can imagine it, you can build it with AccuRev in no time at all.

Our custom AccuBrowse application, viewing a transaction involving a SQL Server stored procedure:

Dr. Strangecode, or How I Learned to Stop Worrying and Love Old Code

September 17th, 2008

by Chris Boran

Several years ago I happened to be browsing in my favourite local bookstore and one book in particular caught my eye: Martin Fowler’s Refactoring: Improving the Design of Existing Code

This is the book that changed my whole career. Up until that point, I had lived in a constant state of fear of change. I viewed old code as a house of cards – if I wasn’t very careful, it was all going to come down around me. Whenever my boss asked me for advice about what to do in a given area of the code, my answers were almost always similar to:

The risk of doing anything but the smallest possible change is huge – so either we do something that is an ugly hack that we will regret later, or we need to take the whole thing apart and re-implement the whole subsystem from the ground up.

And predictably, my boss’s answer was always something like:

Okay, we will live with the hack for now, but in the next release we will make time to do it right.

Of course every release we were forced to make many similar decisions. When the next release would come, the newly conceived product features would get priority over fixing code that was already working passably. In practice we might get lucky and be able to spend lots of time rewriting a single small subsystem, but introduce ugly hacks that would put 4 other systems on the map for future re-implementation.

The end result is affectionately referred to as a Big Ball of Mud. Yup, it is every bit as pleasant as it sounds. Life is just so miserable when you come to work every day knowing you are going to have to pack another layer of mud on the ball. You gripe about it. Your teammates gripe about it. Your boss gripes about it. Somehow you never seem to make a whole lot of forward progress.

As I read the book, I was at first skeptical. I thought that bad old code needed to be thrown away and not revitalized! But I wanted to see if it would work, and so I set out to try it. I was very careful to follow the techniques exactly as they are laid out in the book. I made sure not to use the word refactor when I really meant rewrite. I was careful to refactor the code every time I saw something I wanted to change and not just note it for later. I made sure that my refactorings were small. I took my time with it.

Obviously working this way required that I also be doing very good unit testing, but I had already bought into Test Driven Development. I was already writing unit tests for code before fixing bugs in an attempt to prevent regressions. Running these tests after each refactoring was not a big challenge for me.

Bit by bit I discovered the truth. By applying the refactoring techniques, I could take pieces that I thought needed to completely rewriten and make them better while I was fixing bugs in that area. I could kill two birds with one stone.

Then I discovered Eclipse. The built-in refactoring browser captivated me. Suddenly there was a good, fool proof way to do many of the common refactorings, and automation to keep them introducing new errors. My commitment to refactoring was completed and the defect rates in the code that I was responsible for maintaining declined dramatically. I was a convert. Since that time refactoring has been a cornerstone technique in my arsenal. I no longer lived in fear and loathing of old code!

One refactoring that I have still found to be painful, despite Eclipse’s facilities, is renaming files/classes. In most software configuration management (SCM) tools, renaming files can have unfortunate unintended side effects because the identity of a file is its path. This leads to a great many developers to name a class once, and then never change its name – even if that name does not make sense and the design of the code and the classes primary purpose and responsibilities change.

Luckily for me, I am a long time Accurev user. In Accurev, files are not identified by their pathnames, but rather by a unique id. This makes it possible to quickly and easily rename files with no negative side effect. However this process was inconvenient – I would have to drop out of Eclipse, rename the file with Accurev’s tools, and then refresh my workspace. Not ideal, but it worked. That is why I was so pleased when the Accurev-Eclipse Plugin was released – it integrated the Eclipse Refactoring browser’s rename actions with Accurev’s capabilities to make the whole experience seemless. Accurev has helped me to maintain well thought out, easy to understand designs despite constant evolution to those designs.

Person Martin Fowler’s
Right click for SmartMenu shortcuts