Throughout my career as a developer, one “mantra” that has been deeply ingrained into my brain is “commit away, but DON’T BREAK THE BUILD!”. Breaking the build can include things like breaking checkstyle/pmd checks, committing code that doesn’t even compile, having unit/system test failures, sticking dependencies in the poms that don’t exist in declared repos (example: depending on a SNAPSHOT you built locally) , etc… Bunches of things.
Breaking a build on something you’re the only one working on is usually not a huge issue. Just commit a fix at some point and no-one will ever know. However, when working with a large team or working on OpenSource where people all over the world could be building it, break a build can be a serious issue. If the build is broken, you can easily have MANY engineers wasting a lot of time trying to debug something they shouldn’t be. That can be quite “expensive”.
For example, if I run the tests and see a test failure, I assume one of my changes is the cause of that. Thus, I start debugging and try and figure out what I did. I shouldn’t be trying to debug into tests that aren’t caused by my changes. The code base should be stable and just work.
Unfortunately and apparently, there are a lot of people that don’t believe the same as I do. The Hudson Continuous Integration Game plugin provides an interesting way to see who believes what. Basically, for each build done in Hudson, the plugin assigns a score. If the build succeeds cleanly, all developers that contributed changes get a point. If the build fails spectacularly (fails to even compile), it’s -10 points. A failing unit test is a minus point. Fixing a failing test is a plus point. etc… Thus, over time, people that tend to break things end up with less points (even negative) and those that tend to fix things and/or commit clean code end up positive. Obviously, it’s not perfect. People that commit a LOT can earn higher scores as they can get one point per commit. I commit a couple times a day. Thus, I have potential to get more points than someone who only commits a couple times a week.
Looking at the Apache Hudson Instance Leader Board, you can see quite a range of scores. IMO, there are entirely too many people with negative scores. Something for those people to start working on. Get to work!