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

Did he really need to engage in monkeypatching even in this small example?

Do you really pollute a class as fundamental as String as cavalierly as in this code?




There's absolutely no reason. Then again, there's plety of bad code to go around in this crawler. Just a few nuggets:

* Magic strings with no comments.

* Global variables

* Attempting to write his own URI parser.


Eh. There are different levels of monkeypatching. I have no problem with extending even a fundamental class with a new method if it's done with care, despite the potential downsides. I think the upside of monkeypatching can outweigh the downside when it facilitates tight, readable code (not that I'd consider the code in this post an example of that). The real problems show up when changing the behavior of existing methods, and that's where I think the downsides often outweigh the upsides.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: