Murphy's Law / Sod's Law

In software, Murphy’s Law is often used to explain bugs and production incidents: whatever can go wrong in code (a null pointer, a race condition, a network outage) eventually will manifest, especially in large user bases or at the worst possible time.

In practice, this law encourages developers to write more defensive code. This means checking for nulls, handling exceptions, validating inputs, and failing gracefully when errors occur. It also reminds DevOps teams to anticipate failures by implementing monitoring, enabling rollbacks, and maintaining contingency plans.

  • If an error can happen, it will happen. Plan and code defensively with this in mind.
  • Add error handling, backups, and checks.
  • Edge cases will occur in production. Write tests for these kinds of scenarios.
添加评论
点赞收藏
点踩分享查看原文
评论
?
参与讨论