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?

Formale Metadaten

Titel
Monkey-patching: a magic trick or a powerful tool?
Serientitel
Teil
142
Anzahl der Teile
169
Autor
Lizenz
CC-Namensnennung - keine kommerzielle Nutzung - Weitergabe unter gleichen Bedingungen 3.0 Unported:
Sie dürfen das Werk bzw. den Inhalt zu jedem legalen und nicht-kommerziellen Zweck nutzen, verändern und in unveränderter oder veränderter Form vervielfältigen, verbreiten und öffentlich zugänglich machen, sofern Sie den Namen des Autors/Rechteinhabers in der von ihm festgelegten Weise nennen und das Werk bzw. diesen Inhalt auch in veränderter Form nur unter den Bedingungen dieser Lizenz weitergeben
Identifikatoren
Herausgeber
Erscheinungsjahr
Sprache

Inhaltliche Metadaten

Fachgebiet
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.