CINXE.COM

eileen.codes | The Case Against Monkey Patching

<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>eileen.codes | The Case Against Monkey Patching</title> <meta name="google-site-verification" content="EYDL78pbIclS_cpFovjgs6kHqmKw3sw9xgo19_M42N4" /> <meta name="description" content="Eileen Codes is a blog by Eileen M. Uchitelle about developing with and learning Ruby on Rails, a programming framework." /> <meta name="keywords" content="Eileen Uchitelle, Uchitelle, Eileen M Uchitelle, Abe Uchitelle, Eileen Codes, Ruby on Rails, Eileen Builds with Rails, Builds with Rails, rails, ruby, new york, new york web developer, hudson valley rails, hudson valley web developer, Eileen Carpenter, Eileen M. Carpenter, web development, rails web development, rails websites, rails blogs, rails blogs new york, rails blog eileen, blog about rails, ruby blog, capistrano, unicorn, nginx" /> <link rel="stylesheet" href="/css/main.css"> <link rel="canonical" href="http://eileencodes.com/posts/the-case-against-monkey-patching/"> <link rel="alternate" type="application/rss+xml" title="eileen.codes" href="http://eileencodes.com/feed.xml" /> <link href='https://fonts.googleapis.com/css?family=Raleway:500,700' rel='stylesheet' type='text/css'> <link rel="author" href="https://plus.google.com/u/0/109313797607962965718/posts" /> <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" /> <!-- Google tag (gtag.js) --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-VMFKFZJVRS"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-VMFKFZJVRS'); </script> </head> <body> <header class="site-header"> <div class="wrapper"> <div class="site-title-holder"> <a class="site-title" href="/">eileen.codes</a> </div> <nav class="site-nav"> <a href="#" class="menu-icon"> <svg viewBox="0 0 18 15"> <path fill="#424242" d="M18,1.484c0,0.82-0.665,1.484-1.484,1.484H1.484C0.665,2.969,0,2.304,0,1.484l0,0C0,0.665,0.665,0,1.484,0 h15.031C17.335,0,18,0.665,18,1.484L18,1.484z"/> <path fill="#424242" d="M18,7.516C18,8.335,17.335,9,16.516,9H1.484C0.665,9,0,8.335,0,7.516l0,0c0-0.82,0.665-1.484,1.484-1.484 h15.031C17.335,6.031,18,6.696,18,7.516L18,7.516z"/> <path fill="#424242" d="M18,13.516C18,14.335,17.335,15,16.516,15H1.484C0.665,15,0,14.335,0,13.516l0,0 c0-0.82,0.665-1.484,1.484-1.484h15.031C17.335,12.031,18,12.696,18,13.516L18,13.516z"/> </svg> </a> <div class="trigger"> <a class="page-link" href="/">Blog</a> <a class="page-link" href="/speaking">Speaking</a> </div> </nav> </div> </header> <div class="page-content"> <div class="wrapper main"> <div class="content"> <div class="post"> <header class="post-header"> <p class="post-meta">Feb 21, 2023</p> <h1 class="post-title">The Case Against Monkey Patching</h1> </header> <article class="post-content"> <p>Monkey patching is considered one of the more powerful features of the Ruby programming language. However, by the end of this post I鈥檓 hoping to convince you that they should be used sparingly, if at all, because they are brittle, dangerous, and often unnecessary. I鈥檒l also share tips on how to use them as safely as possible in the rare cases where you do need to monkey patch.</p> <p>Read more on the <a href="https://shopify.engineering/the-case-against-monkey-patching" target="_blank">Shopify Engineering Blog</a></p> </article> <div class="categories"> <strong>Categories:</strong> <a href="/categories/shopify">shopify</a> </div> </div> </div> <div class="sidebar"> <h3>About</h3> <p>Hi, I'm Eileen! I work at Shopify as a Senior Staff Software Engineer on the Ruby and Rails Infrastructure team. I love contributing to open source and speaking at conferences. I've been a member of the Rails Core team since 2017 and the Ruby Core Committers team since 2024. I'm passionate about making the open source world more welcoming and accessible, as well as improving performance, security, and scalability as applications grow.</p> <h4>Where to find me</h4> <ul> <li> <a href="https://twitter.com/eileencodes" class="twitter-follow-button" data-show-count="false" data-size="large" data-dnt="true">Follow @eileencodes</a> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> </li> <li> <a href="https://github.com/eileencodes"> <span class="icon icon--github"> <svg viewBox="0 0 16 16"> <path fill="#828282" d="M7.999,0.431c-4.285,0-7.76,3.474-7.76,7.761 c0,3.428,2.223,6.337,5.307,7.363c0.388,0.071,0.53-0.168,0.53-0.374c0-0.184-0.007-0.672-0.01-1.32 c-2.159,0.469-2.614-1.04-2.614-1.04c-0.353-0.896-0.862-1.135-0.862-1.135c-0.705-0.481,0.053-0.472,0.053-0.472 c0.779,0.055,1.189,0.8,1.189,0.8c0.692,1.186,1.816,0.843,2.258,0.645c0.071-0.502,0.271-0.843,0.493-1.037 C4.86,11.425,3.049,10.76,3.049,7.786c0-0.847,0.302-1.54,0.799-2.082C3.768,5.507,3.501,4.718,3.924,3.65 c0,0,0.652-0.209,2.134,0.796C6.677,4.273,7.34,4.187,8,4.184c0.659,0.003,1.323,0.089,1.943,0.261 c1.482-1.004,2.132-0.796,2.132-0.796c0.423,1.068,0.157,1.857,0.077,2.054c0.497,0.542,0.798,1.235,0.798,2.082 c0,2.981-1.814,3.637-3.543,3.829c0.279,0.24,0.527,0.713,0.527,1.437c0,1.037-0.01,1.874-0.01,2.129 c0,0.208,0.14,0.449,0.534,0.373c3.081-1.028,5.302-3.935,5.302-7.362C15.76,3.906,12.285,0.431,7.999,0.431z"/> </svg> </span> <span class="username">eileencodes</span> </a> </li> <li> <a href="https://linkedin.com/in/eileencodes"> <span class="icon icon--linkedin"> <svg viewBox="0 0 1792 1792"> <path d="M365 1414h231v-694h-231v694zm246-908q-1-52-36-86t-93-34-94.5 34-36.5 86q0 51 35.5 85.5t92.5 34.5h1q59 0 95-34.5t36-85.5zm585 908h231v-398q0-154-73-233t-193-79q-136 0-209 117h2v-101h-231q3 66 0 694h231v-388q0-38 7-56 15-35 45-59.5t74-24.5q116 0 116 157v371zm468-998v960q0 119-84.5 203.5t-203.5 84.5h-960q-119 0-203.5-84.5t-84.5-203.5v-960q0-119 84.5-203.5t203.5-84.5h960q119 0 203.5 84.5t84.5 203.5z"/> </svg> </span> <span class="username">eileencodes</span> </a> </li> <li> <a href="/feed.xml"> <span class="icon icon--rss"> <svg viewBox="0 0 1792 1792"> <path d="M640 1280q0-53-37.5-90.5t-90.5-37.5-90.5 37.5-37.5 90.5 37.5 90.5 90.5 37.5 90.5-37.5 37.5-90.5zm351 94q-13-232-177-396t-396-177q-14-1-24 9t-10 23v128q0 13 8.5 22t21.5 10q154 11 264 121t121 264q1 13 10 21.5t22 8.5h128q13 0 23-10t9-24zm384 1q-5-154-56-297.5t-139.5-260-205-205-260-139.5-297.5-56q-14-1-23 9-10 10-10 23v128q0 13 9 22t22 10q204 7 378 111.5t278.5 278.5 111.5 378q1 13 10 22t22 9h128q13 0 23-10 11-9 9-23zm289-959v960q0 119-84.5 203.5t-203.5 84.5h-960q-119 0-203.5-84.5t-84.5-203.5v-960q0-119 84.5-203.5t203.5-84.5h960q119 0 203.5 84.5t84.5 203.5z"/> </svg> </span> <span class="username">RSS</span> </a> </li> </ul> <br /> <h4>Categories</h4> <ul> <li><a href="/categories/activerecord">activerecord</a></li> <li><a href="/categories/administration">administration</a></li> <li><a href="/categories/cms-functionality">cms-functionality</a></li> <li><a href="/categories/conferences">conferences</a></li> <li><a href="/categories/deployment">deployment</a></li> <li><a href="/categories/errors">errors</a></li> <li><a href="/categories/gems">gems</a></li> <li><a href="/categories/github">github</a></li> <li><a href="/categories/learning-rails">learning-rails</a></li> <li><a href="/categories/mysql">mysql</a></li> <li><a href="/categories/new-features">new-features</a></li> <li><a href="/categories/nginx">nginx</a></li> <li><a href="/categories/nifty-methods">nifty-methods</a></li> <li><a href="/categories/open-source">open-source</a></li> <li><a href="/categories/opinion">opinion</a></li> <li><a href="/categories/rails-5">rails-5</a></li> <li><a href="/categories/shopify">shopify</a></li> <li><a href="/categories/shoutouts">shoutouts</a></li> <li><a href="/categories/tips">tips</a></li> <li><a href="/categories/updates">updates</a></li> <li><a href="/categories/user-experience">user-experience</a></li> </ul> </div> </div> </div> <footer class="site-footer"> <div class="wrapper"> &copy;2017 Eileen M. Uchitelle </div> </footer> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10