|
As someone who has done 4 years of Rails development and has recently switched to Django for new projects, I can tell you it would be worthwhile to learn both. Ruby and Rails are great most of the time, and the Ruby way of doing things is a great learning experience. That said, I threw my hands up after running into multiple libraries duck punching (monkey patching) ActiveSupport into a mangled, conflicting mess one too many times. The open classes thing really is harmful, no matter what anyone tells you. It's a feature that, when used with care, can be very powerful...but the problem is in my experience it's not used with care very often in the Rails world. I've heard Scala solves the issue with open classes by keeping things in context with the code that surrounds it, but I personally haven't verified it. Besides, that's not what you asked. Here's a metaphor that I really feel holds true: Rubyists are magicians...Pythonistas are masons. If you have to rely on your own code only, then by all means delve as deep into magic as possible. However, if you have to rely on other's work, the mason's approach is much more intuitive, reliable, and safe. |
I don't quite agree with this. Of course I agree that you should use monkey patching with care, but it's the implications I disagree with.
First, you can monkey patch in python too. Python doesn't make this safer, but it is used more in the ruby world. I think the implication that I take issue with is that it's rails fault that some other library you used monkey patched rails. It's the libraries fault, and people should look into libraries before they use them. Just as you should use monkey patching with care, you should use other peoples libraries with care. Peek at the code before using it.
Rails 3 makes it easier to change things without monkey patching so it should occur less frequently going forward.