what is moneky patching ?

Monkey-patching is the dangerous-yet-frequently-useful technique of re-opening existing classes to change or add to their behavior. The term monkey patch only refers to dynamic modifications of a class or module at runtime, motivated by the intent to patch existing third-party code as a workaround to a bug or feature which does not act as you desire.

Do not confuse it with sub class and use, that is some thing which the compile time stuff in java and related languages. I can be though of as using filters or reflection to modify or tweek the run time behavior of a class.there are libraries like cglib (code generation library – which adds or intercepts the main class file) which helps to do that.

In monkey patching main class is called and you additional behaviour, however in subclass you have to explicitly call the sub class.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s