Monkey-Patch
A Monkey-Patch (also named Monkey Patch , MonkeyPatch ) translated by modification-monkey is a way of modifying or of extending from the code which will be carried out without modifying the original Source code for dynamic computer programming languages. It also applies in the modification of the software of a system whereas it uses a management system of packages.
The concept is also named:
- Guerilla patch
- Extension of the classes previously to declare
- Reopening of the classes
- Hijacking
Etymology
The term Monkey-Patch was used firstly under the name Guerilla Patch , which refers to a furtive modification and without any rule of the code at the time of its execution. In some applications (as Zope 2) these Patches interacts the one with the others what for consequence of created a battle to determine which will modify the code.With the fact that the words guerilla and gorilla sounds in the same way, people started to use the term incorrect Gorilla Patch instead of Guerilla Patch . When a Développeur of software creates a Guerilla Patch , it test with great difficulty in eliminating the battle between the Patches and thus the term Monkey-Patch was thus designation for this kind of modification of code.
The term Monkey-Patch is used since.
Applications
The modification-monkey is used for:- To replace Methods/Attributes/functions at the object time;
- To modify/extend the behavior or the appearance of a product of a third person without maintaining her own copy of the source code;
- To apply a Patch to the object time to an object in memory without applying it in the source code to the disc;
- Correction of a behavior or a hole of safety which lies in the source code original (an example in the way of is distributed a correction as an addition in the platform Ruby one Rails).
Traps
The use of the modification-monkey comprises the problems according to:- If the product or the package to modify exchange with the new version it doubtless will destroy your Patch;
- If two modules test to make a modification-monkey on the same method, only the last goes " gagner" the battle and the other will not have any effect;
- If the modification-monkey creates a difference between the source code original and on that which is carried out, the resolution of crystallized and bug becomes very difficult, especially if you are not the author of the patch ;
- the use of the modification-monkey can lead to problems of setting-with-days bus the modifications made on the code claims of the assertions which with the son of the modifications are not true any more.
See too
- Javascript
- Ruby
- Ruby one Rails
- Python
- Zope
- TiddlyWiki
| Random links: | Flag of Zimbabwe | Archdiocese of Toronto | The Community of the countries of Portuguese language | My Costa | Thalès Avionics | Gaia_Trafikk |