Skip to Content
Tech PrinciplesNon-Technical ResourcesCobra Effect

Cobra Effect

Context

The cobra effect gets its name from a British bounty program in colonial India. It was intended to reduce the cobra population, but instead led to mass breeding of cobras and a bigger problem.

This highlighted how well-intentioned interventions can backfire spectacularly if incentives and outcomes are not fully thought through. The cobra effect serves as a lesson, particularly great in software development, to carefully consider all consequences when implementing policies and metrics.

Cobra Effect

Issues

Perverse Incentives: Rules or metrics meant to drive improvements can be gamed by developers to hit targets without improving real quality:

  • Measuring commits or lines of code incentivizes pushing “empty” commits or writing bloated, verbose code
  • Tracking ticket closure rates promotes closing tickets without properly fixing issues or rushing solutions
  • Requiring 100% code coverage leads to lots of useless tests just to hit the target

Short-Term Thinking: Quick wins might cause pain down the road

  • Technical debt piles up while new features are prioritized
  • Infrastructure crufts accumulates without ongoing investment

Avoiding Cobra Effects

  • Carefully consider potential negative side effects of metrics and policies
  • Take a holistic view - don’t over-optimize narrow targets
  • Practice systems thinking - identify tradeoffs and indirect effects
Last updated on