We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Monkey-patching: a magic trick or a powerful tool?

Formal Metadata

Title
Monkey-patching: a magic trick or a powerful tool?
Title of Series
Part Number
142
Number of Parts
169
Author
License
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
Elizaveta Shashkova - Monkey-patching: a magic trick or a powerful tool? Monkey-patching is a dynamic modification of a class or a module at runtime. The Python gives developers a great opportunity to use monkey-patching almost everywhere. But should developers do it? Is it a magic trick or a powerful tool? In this talk we will try to give the answers to these questions and try to figure out pros and cons of using monkey- patching. ----- First of all we will learn what is monkey-patching in Python and consider some basic examples of using it. Of course, monkey-patching may cause some problems in the code. We will consider bad ways to use it and try to learn different types of problems monkey-patching may lead to. Despite of some bugs that may appear in a patched program, monkey- patching is used in a real life rather often. There are some reasons and motives to do it. We will consider the examples of using monkey- patching in real projects like `gevent`, in some other libraries and in testing. Also we will learn some monkey-patch tricks that helps to solve real-life problems in the Python debugger which is a part of the PyCharm and the PyDev. After that we will compare using of monkey-patching in Python to using it in an another dynamic language Ruby. Are there any differences between them? Is our reasoning correct for Ruby? Finally we will conclude all our thoughts and examples and try to give the answer to the question from title.