"I have a mind like a steel... uh... thingy." Patrick Logan's weblog.

Search This Blog

Friday, March 21, 2008

Another Dynamic Tools Topic: Are You Learning Toward Or Running Away?

(Via Bill de hÓra)

Ian Bicking:

"It's the second generation that's going to be less enthused, that's going to stare in bafflement at these classes that mysteriously spawn methods, and trying to figure out what's going when there's an exception in dynamically generated code. You can monkeypatch code in Python pretty easily, but we look down on it enough that we call it "monkeypatching". In Ruby they call it "opening a class" and think it's a cool feature. I will assert: we are right, they are wrong."
I know next to nothing about the specific problems the Ruby and Python folks are encountering with "monkeypatching". However this capability is nothing new for dynamic languages. And it is a frequent desire for me when I program in C-like languages. If you become frustrated using static "utility" methods, for example in Java, that work with "closed" classes (say, String or Object), then you have at least some desire for these "monkeypatches".

See the thing is this capability *is* a cool feature in many Lisp and most Smalltalk systems. Sorry, dear readers who hate my Smug Lisp Weeniness. But it is true. Not only is it "cool," moreover it is *pragmatic*.

The truly good implementations of dynamic languages recognize the advantages of these kinds of extensions, and they've supported them with good tools for decades. Learn from it, don't run from it.

People developing large systems in dynamic languages, and people providing dynamic languages being used to build large systems have to also realize this:

You are no longer working with a "scripting" language. You need to demand and provide really good tools. Examples can be found on the internets, read about the Smalltalk and Lisp environments from way back when. Someday you can become as smug as we are, or maybe as brilliant as the people who made them for us.

2 comments:

Barry Kelly said...

You may or may not have read Gilad Bracha's latest post on just this - monkey patching - http://gbracha.blogspot.com/2008/03/monkey-patching.html . This post of yours is actually the one which finally inspired me to unsubscribe!

Patrick Logan said...

Barry -- I hope this means you unsubscribed from Gilad's and not my blog!

Or else I hope Gilad has a really great solution that solves all the problems he's attributed to "monkeypatching".

Blog Archive

About Me

Portland, Oregon, United States
I'm usually writing from my favorite location on the planet, the pacific northwest of the u.s. I write for myself only and unless otherwise specified my posts here should not be taken as representing an official position of my employer. Contact me at my gee mail account, username patrickdlogan.