4 ms·
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.
by rufugee 16y ago
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.
- acpigeon 16y agoThat's a helpful metaphor. What I'm looking for is a framework that can be used for rapid prototyping, and it sounds like rails fits the bill.
- binspace 16y agoYou may also want to consider Sinatra for rapid prototyping. It's lighter weight (less framework) than Rails. Depending on your preferences, it may suite your needs.
- acpigeon 16y agoSinatra is also based on Ruby yes? How does it differ specifically from Rails?
- binspace 16y agoYes, Sinatra is a Ruby web framework. Sinatra is more of a "micro-framework" and puts you closer to the http method. Basically, the api mimics http more closely, you literally use get, put, post, and delete methods to define your routes and actions. In Sinatra, you define your routes in the same place where you program your Resource's functionality, so less mapping is required. In Rails, you have a separate controller and route files. The model layers between Sinatra and Rails are very similar. For example, you can use ActiveRecord in Sinatra.
- binspace 16y agoAlso, if you want rapid prototyping, you should look into a document store such as Mongo. Not having to write migrations (as you would with ActiveRecord + Mysql) is huge. Also, your models can be more flexible. You can add keys to your document as needed. With Mysql, you need to have a migration to add the column.
- rufugee 16y agoNo offense, but this is absolutely bad advice to a newbie programmer. First, mongo_mapper is virtually undocumented, whereas ActiveRecord has oodles of documentation and examples. You'll spend a order of magnitude more time trying to learn to use both MongoDB and mongo_mapper effectively than you will writing a proper set of migrations. Second, I'm tired of all the NoSQL hype. I've worked on a project with MongoDB and MongoMapper, and the combination caused more problems than it solved. If you want cutting edge and all that comes with that, go with Mongo. Otherwise, if you'd prefer to focus on problems in the domain you're trying to solve and not the technology you're trying to solve it with, go with something relational and tried and true (PostgreSQL, if I were deciding).
- deleted 16y ago[deleted]
- binspace 16y agoI'm sick of all of the hype (for the past 20+ years) that relational databases is the only data storage technology you need. When all you have is a hammer...
- rwhitman 16y agoDjango is great for rapid prototyping. The admin area is built in, that alone saves a ridiculous amount of time
- grasshoper 16y agoThe admin will definitely be extremely helpful to someone who is new to databases.
- jshen 16y ago"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 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.
- rufugee 16y agoI guess the issue is the prevalence with which it occurs in Ruby, as you say. I've been programming professionally for over a decade now, in at least as many languages, and I've only had this problem with ruby. Still, I enjoy ruby very much, and I haven't seen my last project in it or Rails. I just need reliability and consistency now, and Python seems to offer more of it. I may as you say hit this same problem in Django, but I haven't yet.
- jshen 16y ago"I've been programming professionally for over a decade now, in at least as many languages, and I've only had this problem with ruby." It's a trade off. Take away monkey patching and you get other problems. Just look at java projects. Once you make an interface and someone else uses it you can't change it anymore without breaking everyones code. Check out the eclipse code base for examples.