DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
The Latest "Software Integration: The Intersection of APIs, Microservices, and Cloud-Based Systems" Trend Report
Get the report
  1. DZone
  2. Culture and Methodologies
  3. Agile
  4. Failed Metric, Failed Build?

Failed Metric, Failed Build?

Matt Stine user avatar by
Matt Stine
·
Nov. 12, 10 · Interview
Like (0)
Save
Tweet
Share
7.48K Views

Join the DZone community and get the full member experience.

Join For Free
A very interesting discussion came up this past weekend during the "Project Automation" Birds of a Feather (BOF) session at the No Fluff Just Stuff show in Reston, VA. We had just spent a fair amount of time discussing how one can set up useful visualizations of common metrics using a combination of Hudson and Sonar; we also looked at how some of the individual Hudson plugins for tools like FindBugs, PMD, Checkstyle, etc., can be used to trigger build failure notifications when certain thresholds are crossed for the metrics that they gather. The discussion eventually evolved to focus on the following question:

Is it appropriate to fail builds based on metrics? If so, when? If not, why?

My quick answer to this question was something along the lines of, "It may be appropriate for your context, but I personally choose not to do this with my team." As it turned out, this raised a few eyebrows, including those of my fellow panelists. Please allow me to summarize my thoughts on this matter.

Let me start off my saying that I believe metrics are incredibly important. One of my favorite software development quotes is related to metrics, spoken by Tom DeMarco:

You can't control what you can't measure...Anything you don't measure at all is out of control.

There are an awful lot of things that we want to manage on software projects: complexity, quality, velocity, etc. If we want to manage these things, we have to gather data. Unfortunately, as software projects grow, gathering all of these data gets incredibly difficult. Fortunately we have the aforementioned tools to help.

With all of that said, it's incredibly important that we're careful about how we decide what to measure. We need to ensure that measuring and controlling a particular variable is going to achieve our desired outcome. Let's consider the all too common "lines of code" (LOC) metric. It's still incredibly prevalent to hear executives, managers and other "non-technical types" bragging about the LOC in their projects. Worse than that, developers' performance evaluations are often based in part on the LOC that they write. The obvious goal is to find an objective measure of developer productivity; since developers "write code," let's see how much code they write! Unfortunately, the enlightened among us know that more often than not, the right thing to do is to reduce the LOC in a project. Any additional line of code increments the complexity of software, decrements its availability, and introduces additional potential points of failure. But if satisfying my addiction to food, clothing and shelter is dependent on writing as many LOC as possible, I'm not going to be too concerned about reducing complexity and increasing maintainability. Thus, the whole house of cards falls down. If you're considering a metric for your project, carefully analyze whether or not it will help you achieve your goals for the project.

Not only that, the team must be absolutely, positively, crystal clear about the purpose of the metric. Our natural tendency is to "game the metric." Think about the extremely popular code coverage metric, and consider the rule that "code coverage must not go down for any check-in." If I'm programming in Java (or a similar language), this can present a problem. If I write a few JavaBeans with the requisite getters and setters and check those in without writing tests, my code coverage will go down. Do I really want developers writing tests for getters and setters? And think about code coverage itself. For the most part, the tools simply measure whether or not code is executed by a test and can't provide any feedback about whether or not the code is meaningful. If all I have to do is make sure code is covered, I can write meaningless unit tests with zero assertions and game the metric. Is this the professional thing to do? No. Does it happen? Yes.

For these two reasons, I prefer to keep metrics set aside as passive feedback rather than active feedback. Our team reviews these fairly regularly and we have discussions during retrospectives and other meetings to examine what our metrics are telling us and take action where necessary. The converse to this is the situation where I can't deploy to production without a passing build (since my deployment process is completely automated and based on my CI server - more on this in a later article), and writing a meaningless unit test to up the coverage will allow me to go home. I don't want to put my developers in that spot. Call me "not agile" if you want, but I feel like we're being effective in meeting our project goals.

The counterargument to this idea is that we want to keep the feedback/response cycle very tight. If I make a change that causes negative movement in a metric, I need to know that as quickly as possible so that I can respond effectively. If I don't find out for a week, I won't know what I was doing at that point and time and it will be harder for me to respond. I fully agree with these statements. We do want to keep this feedback loop as tight as possible. So, in your context, if you have a metric that is well characterized, will help you achieve your goals, and is very well understood by the entire team, by all means - include it in your build failure decision tree. However, I think it's equally valid to visit these in a more passive way during a weekly retrospective.

At any rate, I'm much more interested in the overall trend for my projects than point in time numbers. Tools like Sonar with its "Time Machine" feature make this much easier to see. If I see that my code coverage has been steadily dropping for the past week, I'm going to raise a flag. But if I see code coverage drop for one build and then steadily continue to rise, who really cares? My team is doing the right thing already.

Whatever you decide to do, first think - is this going to help my team achieve its goals? Second communicate - make sure everyone understands the metric and why it's there. If you properly handle these two items, I think you're more than qualified to make the "build failure" decision on your own.
Metric (unit) Continuous Integration/Deployment Code coverage Software development unit test agile

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Benefits and Challenges of Multi-Cloud Integration
  • The Power of Docker Images: A Comprehensive Guide to Building From Scratch
  • Create a CLI Chatbot With the ChatGPT API and Node.js
  • Demystifying the Infrastructure as Code Landscape

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: