# The Case Against Monkey Patching, From a Rails Core Team Member

DevFeed: [The Case Against Monkey Patching, From a Rails Core Team Member](<https://devfeed.tech/articles/the-case-against-monkey-patching-from-a-rails-core-team-member-1642.md>)

Original publisher: [Read original article](<https://shopify.engineering/the-case-against-monkey-patching>)

Author: Eileen Uchitelle

Published: 2023-02-21T14:00:04Z

Content type: opinion

Language: en

Sources: [Shopify Engineering](<https://devfeed.tech/sources/shopify-engineering.md>), [Shopify Engineering - Shopify Engineering](<https://devfeed.tech/sources/shopify-engineering-shopify-engineering.md>)

Topics: [Rails](<https://devfeed.tech/topics/rails.md>), [Ruby](<https://devfeed.tech/topics/ruby.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Open Source](<https://devfeed.tech/topics/open-source.md>)

Tags: [framework](<https://devfeed.tech/tags/framework.md>), [open-source](<https://devfeed.tech/tags/open-source.md>), [pull-request](<https://devfeed.tech/tags/pull-request.md>), [ruby](<https://devfeed.tech/tags/ruby.md>), [ruby-programming-language](<https://devfeed.tech/tags/ruby-programming-language.md>), [shopify](<https://devfeed.tech/tags/shopify.md>)

## AI overview

This opinion argues that Ruby monkey patches should be used sparingly, if at all, because they are brittle, dangerous, and often unnecessary. It defines monkey patches as dynamic changes to existing code, discusses an Active Record adapter that altered MySQL query-warning behavior, and describes upstreaming that behavior into Rails to remove the patch.

## Source excerpt

Monkey patching is considered one of the more powerful features of the Ruby programming language. However, by the end of this post I'm hoping to convince you that they should be used sparingly, if at all, because they are brittle, dangerous, and often unnecessary. I'll also share tips on how to use them as safely as possible in the rare cases where you do need to monkey patch.