The Case Against Monkey Patching, From a Rails Core Team Member - Shopify
Feb 21, 2023

Summary
This post argues against the common practice of monkey patching in Ruby, highlighting its dangers including making upgrades difficult, introducing security vulnerabilities, increasing technical debt, and negatively impacting open-source citizenship. It advocates for upstream contributions as a safer alternative and discusses refinements as a more contained but still problematic approach due to performance impacts. The post provides guidelines for when monkey patching is unavoidable, emphasizing notifying upstream maintainers and considering alternatives like upgrades or correct usage.