Hacker News new | past | comments | ask | show | jobs | submit login

Depending on the strain of web development you encounter, it's more or less common in Javascript. Part of that might be overlap with Rails people, but there's such a long history of having to patch broken and missing JS language features and standard library functions in incompatible browsers that monkey-patching is normalized under the name of polyfills.

Once you're used to doing that kind of thing, people will feel the urge to take things to the next level, augmenting standard functionality and replacing the original functionality globally. Maybe you replace console.log() with a wrapper that includes a timestamp in the output, for instance. Not insane, and manageable for a smaller project that you have your head around.

It falls apart awfully quickly as it scales though. If behavior in your system diverges from standard because of a maze of monkeypatching, then you have to learn those quirks or there is a lot of frustration. And the possibility of spooky breaking changes in seemingly unrelated components becomes a big problem.




While this is technically the same thing as the rampant monkeypatching that happens in ruby, there is a difference in practice, in that polyfills tend to be written to emulate well defined interfaces that simply aren’t there, whereas monkeypatching adds random magic like the aforementioned “weeks” method on numbers.

This is personal preference, but I find it utterly absurd to adorn numbers with these time dimensioning methods. Why not volume or length too? Should I be able to say 2.miles? Why would an integer be innately bound to time, as opposed to a unitless mathematical abstraction? Ruby folks like to add these gimmicks that make code “read like English” and I find it very cutesy, for lack of a better word. When I see stuff like this, I’m distracted by pondering what the hell the magic actually means. Can I say 6.from_now? Yes, actually, I can. Does it make any sense that what I call “from_now” on is technically a unitless number? No, not at all. It is a pretense that it’s a dimensioned number for the sake of cuteness.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: