It happened on a project I was working on that we had to implement a divide & conquer algorithm using our background jobs processor, in this case we were using sidekiq. Implementing this using sidekiq can be quite challenging since all the workers are independent and they do not trigger any callback once they’re done.
Designing an API in Hell
Minitest, Ruby’s built-in testing library, has some great out-of-the-box features. One of these is test parallelization. Parallel testing is often added after a suite gets slow enough to hurt. That can be achieved using the parallel_tests gem, which takes advantage of today’s multi-core processors, or using custom solutions for dividing chunks of a suite across several machines. Arguably, test speed should be dealt with by making code design changes, but that’s another story: what interests me most about minitest’s parallelization is the constraints it places upon the design of stateful systems when TDDing from scratch.
You can turn on parallelization for a particular test case:
describe Server do
parallelize_me!
end
or for all tests:
require 'minitest/hell'
As the name implies, the latter approach turns up the test pain level to 11, but it’s the kind of pain that can have positive effects. For ‘fun’, I started to use minitest’s parallelization on a side project, which has a stateful API backed by a relational database. Here are some of the decisions that were forced out by using parallel test examples.
Commitment to fast tests
I thought that running tests in parallel from the start of a project would make me lazy, causing me to neglect slow tests because they’d be running at the same time as others. Surprisingly, the opposite happened: the need to constantly rerun the whole suite to iron out nondeterministic conflicts encouraged me to fix slow tests early. I ended up being able to run the entire suite several times within a matter of seconds in order to check the tests’ ability to run in parallel.
Side note: this is an early-stage project, with a very low quantity of tests! It will be interesting to see how test speed increases as the volume of tests increases.
Avoiding test duplication
Since the unique constraints of my database could be hit by tests with the same fixture data running at the same time, I was encouraged to use more intention revealing test data for each example, avoiding foo and bar, which commonly litter a suite and make tests harder to read.
For IDs, I used Ruby’s SecureRandom library, which provides GUID and hex generation. I sometimes used hex generation when the user-supplied unique display name of something didn’t matter to the test.
Client-side ID generation
Although not strictly forced out from parallel tests, parallel testing got me thinking about how best to interact with the backend, which has a single database being served by multiple concurrent requests (just like any web server).
Using GUIDs instead of autoincrementing IDs can be a smart decision to make if you can (i.e. you don’t need human-friendly URLs), because it means your database server doesn’t need to worry as much about ensuring uniqueness, since the GUID algorithm effectively guarantees it.
TDDing my API from scratch, without external requirements, encouraged me to use GUIDs to simplify the design and to avoid bottlenecks at the database layer. POST requests canonically return the new URL of the resource you’re creating in the Location header of the response. So to test that a thing really got persisted I’d need to:
- POST to /items with a representation of the resource
- Grab the Location header of the response to get the new URL
- GET /items/:newid and ensure the response body matched the representation I sent
This seemed a very laborious process for storing some data. Much less work is:
- PUT to /items/:newid
- GET /items/:newid and ensure the response body matched the representation I sent
Since GUIDs can be treated as unique, it didn’t make much sense for the server to generate them.
Positive effect: the app would now cope with a distributed database system on the back-end, despite starting out on a technology that’s thought of as difficult to scale horizontally (SQLite).
Avoiding database resets
It’s common practice to wipe the whole database when starting a new example, or to run each example in a transaction and roll it back when each example finishes. I wanted real black-box tests, so I didn’t want to use transactions. Yet, deleting the whole database at the start of an example didn’t play nice with minitest’s parallelization, since data that one example required would be deleted by another.
The usual approach when using parallel_tests is to create a database for each process. However, since minitest doesn’t manage databases (nor should it) I chose to keep a single database and find a different solution.
I chose to sandbox all of the tests by creating new entities each time, and only checking for output that indicated that particular entity had been worked on. The product I’m working on is a Continuous Integration server, so I’d be creating CI projects (you might also know them as jobs) and expecting them to appear in an XML feed. The tests had to be OK with other data being present, since the other tests could be working too.
This approach precluded tests that checked that the number of records had increased by one, because in an otherwise acceptable “green” test situation they’d occasionally increase by more than one (another test added a record too), stay the same (another test deleted a record) or decrease (more than one had been deleted).
Constraints are fun
While I wouldn’t recommend going rogue like this on a client project, playing with constraints like truly parallel tests can get you thinking about your normal testing procedure. Some of the above decisions allowed for a much faster test execution time, and always having the assumption that other processes could be working on the database forced out some interesting techniques. Some of the techniques I had to avoid due to parallelization would normally necessitate different workarounds with their own drawbacks. For example, if you always assume the count of an ActiveRecord class will go up, you require exclusive use of the database. If instead you scope your queries to a parent entity, this restriction would be removed.
Hell isn’t so bad after all.
Method Modeling: A Refactoring
While working on AwesomeResource, I needed to implement functionality that would make the following test pass:
it "creates readers and writers for any attributes passed in during initialization" do
article_class = Class.new do
include AwesomeResource
end
article = article_class.new("title" => "Fun")
article.title.should == "Fun"
article.title = 'Fun Times!'
article.title.should == 'Fun Times!'
expect { article.unknown_attribute }.to raise_exception
end
Simple enough. If you initialize an instance of a class that includes AwesomeResource, then you get attribute readers and writers for any hash keys passed in during initialization.
My first attempt at implementation looked something like this:
module AwesomeResource
attr_reader :awesome_attributes
def initialize(attributes={})
@awesome_attributes = AwesomeResource::Attributes.new attributes
end
def method_missing(method_name, *args)
if method_name["="]
if awesome_attributes.has_key?(method_name[0...-1])
awesome_attributes[method_name[0…-1]] = args.first
else
super
end
else
if awesome_attributes.has_key?(method_name)
awesome_attributes[method_name]
else
super
end
end
end
end
Yuk. All those nested if/else’s didn’t sit well with me. Let me try to clean that up:
def method_missing(method_name, *args)
if method_name["="] && awesome_attributes.has_key?(method_name[0...-1])
awesome_attributes[method_name[0...-1]] = args.first
elsif awesome_attributes.has_key?(method_name)
awesome_attributes[method_name]
else
super
end
end
The best I can say for this code is that it’s more compact. But is it any more readable? Hardly. In fact it’s worse.
Let’s take another look at the first implementation. The nested if/else blocks look awfully similar. Perhaps there’s a polymorphic model lurking there? But what are we modeling? If we were to wrap a class around those blocks, we’d have to be modeling a method. What would that look like? Let’s extract some classes:
class AttributeWriter
attr_reader :attributes
def initialize(attributes)
@attributes = attributes
end
def call(attribute_name, attribute_value)
raise "Unknown Attribute" unless attributes.has_key?(attribute_name)
attributes[attribute_name] = attribute_value
end
end
class AttributeReader
attr_reader :attributes
def initialize(attributes)
@attributes = attributes
end
def call(attribute_name)
raise "Unknown Attribute" unless attributes.has_key?(attribute_name)
attributes[attribute_name]
end
end
def method_missing(method_name, *args)
if method_name["="]
AttributeWriter.new(awesome_attributes).call(method_name[0...-1], *args)
else
AttributeReader.new(awesome_attributes).call(method_name)
end
end
OK, I at least feel like I’m trying to write OO code at this point. There’s a bit of duplication between the AttributeReader and AttributeWriter classes. We could clean that up with template methods:
class AttributeAccessor
attr_reader :attributes, :attribute_name
def initialize(attributes, attribute_name)
@attribute_name = attribute_name
@attributes = attributes
end
def call(*args)
raise "Unknown Attribute" unless attributes.has_key?(attribute_name)
execute(*args)
end
def execute(*)
end
end
class AttributeWriter < AttributeAccessor
def attribute_name
super[0...-1]
end
def execute(attribute_value)
attributes[attribute_name] = attribute_value
end
end
class AttributeReader < AttributeAccessor
def execute
attributes[attribute_name]
end
end
def method_missing(method_name, *args)
if method_name["="]
AttributeWriter.new(awesome_attributes, method_name).call(*args)
else
AttributeReader.new(awesome_attributes, method_name).call
end
end
Notice that we've moved the responsibility of stripping off the "=" off the method_name from method_missing down into AttributeWriter.
Hmmm... The base class is pretty abstract. How easy it this code to understand now?
Also, the body of the method missing now looks a lot like a factory method. While in Rome...
class AttributeAccessor
attr_reader :attributes, :attribute_name
def self.from_method_name(attributes, method_name)
if method_name["="]
AttributeWriter.new(attributes, method_name)
else
AttributeReader.new(attributes, method_name)
end
end
def initialize(attributes, attribute_name)
@attribute_name = attribute_name
@attributes = attributes
end
def call(*args)
raise "Unknown Attribute" unless attributes.has_key?(attribute_name)
execute(*args)
end
def execute(*)
end
end
class AttributeWriter < AttributeAccessor
def attribute_name
super[0...-1]
end
def execute(attribute_value)
attributes[attribute_name] = attribute_value
end
end
class AttributeReader < AttributeAccessor
def execute
attributes[attribute_name]
end
end
def method_missing(method_name, *args)
AttributeAccessor.from_method_name(awesome_attributes, method_name).call(*args)
end
I'm now starting to question this code. Is there a good trade off here between indirection and maintainability? I don't think the number of accessors are likely to grow (accessors have consisted solely of getters and setters since the dawn of OO). Between all of the refactorings, I think the first (with its minor duplication) was the easiest to understand.
Yet something still doesn't feel right. Let's look back at the very first code snippet. Notice the `AwesomeResource::Attributes.new` in the `initialization` method? Those are our bag of attributes (they're basically a hash with indifferent access). We keep passing it around to all of our Attribute* classes… perhaps some of this code should have lived there in the first place?
module AwesomeResource
attr_reader :awesome_attributes
def initialize(attributes={})
@awesome_attributes = AwesomeResource::Attributes.new attributes
end
def method_missing(method_name, *args)
awesome_attributes.accessor_for_method_name(method_name).call(*args)
end
end
module AwesomeResource
class Attributes < SimpleDelegator
#...
def accessor_for_method_name(method_name)
if method_name["="]
->(attribute_value) { self[method_name[0...-1]] = attribute_value }
else
-> { self[method_name] }
end
end
def [](key)
validate_key_exists(key)
attributes[standardized_key(key)]
end
def []=(key, value)
validate_key_exists(key)
attributes[standardized_key(key)] = value
end
private
def validate_key_exists(key)
raise "Unknown attribute" unless has_key? key
end
#...
end
end
This feels right. We're now modeling methods with lambdas (Ruby's built in method objects). We've eliminated a tangle of nested if/else blocks without introducing too much indirection. We've maintained high-cohesion within the AwesomeResource::Attributes class despite the new methods.
Sencha Touch BDD – Part 5 – Controller Testing
Sencha Touch BDD
tl;dr
A multi-part series of articles on how to test Sencha Touch applications. It uses Jasmine for unit testing and Siesta for integration testing.
Part 5 – Controller Testing
Recap
Part 4 Introduced PhantomJS as an easy and faster alternative to headful Jasmine testing. Part 3 added jasmine-ajax so we can verify that stores and models react properly to back-end data. We also learned how to use stores to test views, without depending on a back-end server. In Part 2 I showed you how to unit test Sencha model classes in Jasmine. In Part 1 I showed you how to set up your Sencha Touch development environment to use the Jasmine JavaScript test framework.
It’s a control thing, but I will let you understand
Sencha Touch controllers usually live within the context of a single application object. Normally, this is handled for you when you invoke Ext.Application() in your app.js file. It creates a singleton object for you in the namespace of your application. For example, if you configured your application’s name to be ‘SenchaBdd’, then the application will be available as the .app attribute of the global SenchaBdd object, that is, SenchaBdd.app.
Unit testing should not have a running application, however. The point is that we are testing classes in isolation. There’s nothing isolated about an integrated, running, Javascript application. There is a relatively simple solution, however; You need to create you own “test” application object that you can then pass as a configuration option when you create controllers under test.
$ cat spec/javascripts/controller/MyControllerSpec.js
describe('SenchaBdd.controller.MyController', function() {
var controller, app;
beforeEach(function () {
app = Ext.create('Ext.app.Application', {name: 'SenchaBdd'});
controller = Ext.create('SenchaBdd.controller.MyController', { application: app });
controller.launch();
});
afterEach(function() { app.destroy(); })You may want to refactor the application creation and tear-down into a spec helper, to DRY out your tests.
Test behaviors, not events
It’s tempting to write a Jasmine test that tries to trigger an event in the DOM, then follow the event handling through the application. This is the road to hell. If you find yourself trying to simulate an event, please stop. That is what integration tests are better at doing. Controllers are classes like any other, and you should test methods in the same way. For example, let’s drive out a behavior where, when a user taps on the ‘Buy’ button our application sends a request to the back-end.
describe('SenchaBdd.controller.MyController', function () {
var controller, app;
beforeEach(function () {
app = Ext.create('Ext.app.Application', {name: 'SenchaBdd'});
controller = Ext.create('SenchaBdd.controller.MyController', { application: app });
controller.launch();
});
afterEach(function () {
app.destroy();
});
it('#newOrder', function () {
var order = controller.newOrder();
expect(order.$className).toEqual('SenchaBdd.model.MyModel');
expect(order.phantom).toBeTruthy();
});
describe('#onBuy', function() {
it('calls save on the order', function() {
var myOrder = Ext.create('SenchaBdd.model.MyModel');
spyOn(myOrder, 'save');
spyOn(controller, 'newOrder').andCallFake(function() {
return myOrder;
});
controller.onBuy()
expect(myOrder.save).toHaveBeenCalled();
})
})
});You might notice that I neither ‘tap’, nor do I test for a ‘POST’ ajax call. The former is better tested through integration tests. The latter is better tested in the model. All the controller need do assert that the model was saved. We trust external classes to function (because they’re tested, too, right?) Testing the #save method on the model follows the same process as testing stores, as I outlined in Part3. Another thing to note is that, under test, this controller does not have any views associated with it; Ext.ComponentQuery calls will return empty (undefined) results. This is to be expected in an isolated test, but may make for some head scratching when you first encounter it. If you must test something in the DOM, you should be writing an integration test anyway.
Ext.define('SenchaBdd.controller.MyController', {
extend: 'Ext.app.Controller',
config: {
views: ['MyView'],
refs: {
buyButton: 'myview #buyButton'
},
control: {
buyButton: { tap: 'onBuy' }
}
},
newOrder: function () {
return Ext.create('SenchaBdd.model.MyModel');
},
onBuy: function () {
this.newOrder().save();
}
});As a personal preference, and make it easier to test and refactor, I have a #newOrder method that delegates to the model to create a new instance.
git rebase vs. git merge: an agile perspective
At Pivotal Labs, we’ve been using Quandora for about 6 months as an easier way to archive and discover discussions about the hows and whys of consulting and software engineering here. Earlier this week, I asked my colleagues:
There are some git workflows that would have you regularly work in feature branches and then merge back into master only when the feature is ready for acceptance. However, on every project I’ve worked on at Pivotal, we have preferred to rebase and commit to master regularly.
Why prefer rebasing over merging?
I received some excellent answers.
Rasheed explains:
The more code diverges, the more difficult it is to integrate. If you want continuous integration, it’s a lot easier to do so on one branch, not many. It also drives out stories that are small, have the smallest actionable work, and are easy to accept. This leads to tight feedback loops.
Chad had some information to add to Rasheed’s answer:
Tight feedback loops are one of the things that Pivotal values.
We place priority on CI and small stories. This makes it easier to work on master – it’s not a big deal if it is accidentally broken, it’ll be easily fixed or reverted.
In my experience, we still do use topic branches when appropriate. E.g., in the middle of a story at the end of a day, or for a bigger feature that you don’t want to do in one commit, but would break mainline (master) with the intermediate commit. On my project, in this case, we usually merge –squash –no-commit onto master, to squash multiple commits on the topic branch into one commit on master.
Even in git, branching is still painful. The longer a topic branch lives, the harder it is to merge. Yes, you can rebase often, but that means you have to rewrite history to push the rebased changes to the server. This can cause confusion if the branch lives long and is worked on by multiple pairs or on multiple machines. So, it’s usually less net effort to just work on master, because we have good tests and can trust CI to quickly tell us if there’s any glaring logical merge conflicts that were missed. On teams without CI that rely solely on manual QA, this is much more of a risk and more expensive.
And Jacob, the director of our new Boston office, had this to say:
I’ve seen both patterns at Pivotal. Teams that rebase tend to be small and haven’t had a production release. Large teams have a quickly changing repo and feature branches make the history more readable. And teams that have released use feature branches to relegate incomplete code to a future release. They can also (in theory if not practice) easily roll-back an entire feature branch if something goes wrong in production.
Of course, as Rasheed mentions, trying to wrangle large unreleased changes causes all kinds of problems. Better to get faster feedback with smaller releasable features. If your team still feels it needs to have incomplete features in master, or needs to disable misbehaving pieces of the app, read up about feature switches and look into a tool like rollout or flipper.
So, it seems that in general, we tend to prefer rebasing because it helps facilitate some core concepts of agile software development:
- Continuous deployment
- Tight feedback loops
- Small deliverables
Thanks to Rasheed, Chad, and Jacob for helping provide some great content!
Lunchtime Drawtime!
How To: Use Skip Navigation Links for Better Keyboard Accessibility
For improved keyboard accessibility, use skip navigation links along with a coherent heading outline, ARIA landmarks, and a javascript polyfill for Webkit based browsers.
Why Use Skip Navigation Links?
It can be frustrating and fatiguing for folks with limited mobility to have to have to repeatedly tab through navigation links to get to the main content of a page. People who use screen readers face similar frustration when the page outline is not well defined. In order to address this issue, version 2.0 of the Web Content Accessibility Guidelines (WCAG 2.0) has specified a guideline for bypassing repetitive blocks of content. One technique recommended by the W3C is to include a skip navigation link at the beginning of the page, that changes focus to the first element after the repeated content.
How do I use Skip Navigation Links?
Add a link at the top of your body content whose href value points to the id of the element that wraps your primary content. Like so:
Disclaimer: The mechanism by which skip navigation links work had been broken in Webkit based browsers for some time and has only recently been fixed. Until these browsers release the fixes, you may need to use a javascript polyfill to make skip nav links work.
What about ARIA?
Skip nav links are useful for users who use keyboard navigation only, but screen readers now support more sophisticated ways of navigating regions. Specifically, they support heading navigation and ARIA landmarks. You should take advantage of these features by using a clear heading outline and defining page regions.
Note: The last post I authored, Use ARIA Landmarks Instead of Skip Nav Links, presented a strategy that was predicated in part on the fact that skip navigation links have been broken in Webkit for the past three years. This bug has recently been fixed, so I was inspired to revisit the topic.
Stop leaky APIs
There are many blogs about how to expose an API for a Rails application and many times I look at this and am concerned about how these examples often leak the application design and the schema out through the API. When this leak occurs a change to the application internals can ripple out and break clients of an API, or force applications to namespace URI paths which I feel is unnecessary and ugly.
When the only consumer of application data models are the views within the same application then the object design can be fluid and malleable. Once an application exposes an API to more than one client, and especially if that client is on a different release cycle to the server, such as iPhone application, data models become rigid. Rails tends discouraged N-tier architecture to the benefit of development speed but APIs are contracts between a server and it’s client and can be difficult to change once they start being used.
Passing an object into the Rails JSON serialisation methods will work for a time, but relying on this will only get you so far. At some point a refactor will take place that will cause a breaking change. It could be something simple such as renaming a column, moving responsibilities from one class to another or adding extra meta-data to a response. Either way, adding this information into your model class starts to place more responsibilities into one place.
There are a few ways out of this potential issue. Let’s take a look at the classic blog application and its Post object. The Rails rendering engine will call as_json on an object if the request has sent the content-type of application\json to the server. Here we override the implementation from ActiveRecord to provide a stable, known version:
def as_json(options={})
{
author_id: author.id
title: title
}
end
A second option is to model the object explicitly and serialise the internal model into a public representation. We can duck-type the object to respond how ActiveRecord objects behave during a serialisation call. Although this can be seen as a step towards a N-tier architecture, it’s also a step towards service dependent abstraction:
class Api::Post
attr_reader :post
def initialize(post)
@post = post
end
def as_json(options={})
{
author_id: post.author.id
title: post.title
}
end
end
The benefit of doing this is a separation of concerns between your data model and the data presentation. An application model doesn’t need to know how it’ll be represented by an API, command line interface or any other outside communication mechanism. If an application were tending more towards HATEOAS for instance this separation could help resolve hyperlinks relevant to the interface. You may lose some of the Rails respond_with goodness with this:
respond_to :html, :json
def show
post = Post.find(params[:id])
respond_to |format| do
format.html { @post = post }
format.json { render json: Api::Post.new(post) }
end
end
That can be regained with the help of a presenter:
respond_to :html, :json
def show
post = Post.find(params[:id])
@presenter = PostPresenter.new(post)
respond_with @presenter
end
Where PostPresenter may look something like:
class PostPresenter < SimpleDelegator
def as_json(options={})
Api::Post.new(self).as_json(options)
end
end
What’s the difference between this and putting the as_json method into Post directly? More control, separation of concerns with application modeling vs presentation and the big win is when breaking changes occur within the API. Now we can put version relevant information into new objects, or into the serialised class itself.
class Api::Post
attr_reader :post, :version
def initialize(post, version)
@post = post
@version = version
end
def as_json(options={})
send("v#{:version}")
end
private
def v20130505
# version specific JSON
end
def v20121206
# version specific JSON
end
end
Through this we have versioning information in one place and through a request parameter of something like v=20130506 the application can handle multiple versions in one object. For me, this ultimately removes URIs like /v1/posts, but why is that important? The URI is an identifier which points to a resource and having v1 or v2 in the URI muddies the fact that the two identifiers are pointing to the same resource. Using a request parameter, much like pagination is handled, means we can ask for a representation of that resource rather than having to specify different resources. Then we can do away with needing controllers such as Api::V1::PostsController and just deal with Api::PostsController or even just PostsController and deal with the versioning within the object instead of the URI path.
ElementalJS and SimpleBDD open source updates
Thanks to the benefits of Open Source software and working with great people, I’m pleased to announce some updates to both ElementalJS and to SimpleBDD.
ElementalJS
Thanks to Ian Zabel who made a performance improvement to ElementalJS after fighting a large DOM in Internet Explorer. Elemental will now load the behaviours much quicker if the document is passed as no filtering will take place. If another node is passed, filtering will be applied but the thought is that DOM will be much smaller so hopefully won’t hit this issue.
SimpleBDD
Thanks to Adam Berlin who made two improvements to SimpleBDD. First was the addition to also to the syntax and second was NoMethodError is replaced by pending if using RSpec.
More improvements were made by Daniel Finnie which allow use of some non alphanumeric characters that get turned into method names.
Gansen and Kunesh on Agile Development in the Obama 2012 Campaign

Juan Camilo Bernal / Shutterstock.com
The Obama 2012 campaign has been hailed as the most tech-savvy and data-driven to date, a sophisticated operation led by CTO Harper Reed. Reed had no problem finding developers eager to join the campaign — the challenge was finding people up for the formidable task before them. A Presidential campaign poses unique challenges: an environment where volatility is the only constant, developers must iterate often, yet there is little margin for error. To meet this challenge, Reed and his team placed an emphasis on people who could resolve problems and learn quickly, rather than focusing on a particular skill set.
Within this heady environment, Chris Gansen, the campaign’s Senior Software Engineer, and Jason Kunesh, Director of User Experience and Product, embraced the methodologies of agile software development.
While much attention was paid to the Obama 2012 tech team’s online voter outreach efforts, its on-the-ground campaign was equally impressive, turning information collected by volunteers knocking on their neighbors’ doors into grist for fine-grained data collection and analytics. This was undertaken by roughly “1000 neighborhood teams with tens of thousand of volunteer leaders,” according to Gansen.
A voter outreach campaign of such size and complexity demanded a bi-directional communication and data collection tool. Gansen and Kunesh were deeply involved in building the resulting product, Dashboard, which gave volunteer leaders a way to connect, organize, and report progress. Dashboard became a gold mine of voter-reported data, providing the campaign with insights and strategies to effectively communicate to voters and coordinate volunteers, at both a macro and micro scale. Gansen describes the lauded voter outreach and analytics platform as “the culmination of many years of trying to unify online and offline campaign organizing.”
Dashboard grew to one of the largest projects within the campaign, boasting 40–50 engineers divided between five separate tracks, or “Work Streams,” as they were known within the campaign.
From Agile Skepticism to Proven Success
Comfortable with the proven, tightly managed, topdown management model of campaigns past, veteran politicos were initially skeptical of agile development practices. “We fought really hard to get people in the campaign to embrace iterative development,” says Gansen. “In government, you tend to see technology coming from vendors, and measured by the quarter. When we would say, ‘we’re going to launch this and there are going to be bugs,’ a lot of people in the campaign hesitated. They hadn’t done this before, and we had to be flawlessly representing the brand of the President.”
“Software isn’t like that,” he says. “It can be messy, and so we had to show them through iterating, and being accountable to what we were doing, that things improved over time.” Despite their initial pushback, the clarity and transparency of this approach won converts among the skeptics. “We had great technologists who’d never worked on campaigns, and great campaigners who’d never participated in shaping software,” says Kunesh. “Before we understood each others’ worlds, agile was a way for us to agree on what we were building and how.”
It also allowed them to prioritize high-value goals and milestones, while being able to quickly change course when necessary. “Since the goals of the campaign change depending upon what phase of campaigning you are in, responding dynamically was a requirement,” says Kunesh. “The things that were important in February are meaningless at the end of summer, but they are the features you needed in the spring. Agile helped us stay focused on shipping the most important features.”
The campaign measured every conceivable metric — voter data, usage and performance at every level of the technology stacks, and project velocity, to name a handful of metrics. Gansen, Kunesh, and their teams turned to Pivotal Tracker to collaborate, track progress, and perhaps most importantly, communicate their workload and progress to other stakeholders in the campaign. Tracker’s emphasis on agile development methodology, prioritization and collaboration was well-suited to the environment. For the Dashboard initiative, each of the five work streams were divided into separate Tracker projects. Every feature on the Dashboard project had a corresponding Tracker story, and they used release markers heavily to represent milestones.
“With very constrained time, we had to decide quickly whether to improve a feature or axe it,” says Gansen. “In campaigns, you never make a decision that isn’t backed up with data, so being able to pair data-driven development with agile delivery helped build products that people actually used.”
Gansen found that Tracker and agile development practices helped the team make the case for decisions, clearly demonstrate what milestones had been reached, and accurately predict when upcoming milestones would be hit. “From a product perspective,” he says, “the two things that were most successful was the transparency and the accountability of quick, weekly releases. We were able to say, ‘this is what we’re going to do,’ and then a week later come back and say, ‘we did what we said we would do, and if we didn’t, here’s what came up.’”
It also eased the process of onboarding new developers, Kunesh says. “It gave us a common platform and methodology to follow,” he says. “We were building our team as we were building our products. Pivotal Tracker offered a built-in workflow that let us move engineers from team to team while still having a common process.”
Battle-tested and Unbowed
The members of that team have gone their separate ways, like the tech industry equivalent of a pack of sage cowboys riding off into the sunset. Products such as Dashboard now lay in hibernation until the next election season. Fortunately, the likes of Gansen and Kunesh are sharing the hard-learned lessons they learned during those intense 18 months.
Gansen, who now consults for the civic technology organization Smart Chicago Collaborative, has developed a healthy obsession with collecting and analyzing all the data one might have available. “Measurement is key because you can’t make decisions on information you don’t have,” he says. “Measure everything, and do it early on, because even with a small amount of data, you can make decisions. Over time, the data only grows more and more valuable.”
Both Gansen and Kunesh evangelize for the value of developing and deploying transparently within an organization, and using that openness to engage nontechnical stakeholders. It’s a matter of “Communication and building trust,” Kunesh says. “Operate openly and transparently with what you’re doing with the people involved in the process,” Gansen adds. “When a technical team is interacting with a nontechnical team,” he says, such clarity and transparency “is essential.”
