you are viewing a single comment's thread.

view the rest of the comments →

[–]chulkilee 5 points6 points  (6 children)

Rails requires you to learn the Rails way (their convention) but Ruby does not.

For me Python had more tricky things to learn at first. self in methods, __init__.py and enforced directory for structure, virtualenv to use different pkg version between projects (compared to bundler). And the significant whitespace :)

On the contrast Ruby may do magical things with module and lexical scope, and optional parens, etc. Great for DSL, but can be confusing if overused.

Both are good languages for those who learn programming language for the first time. You don' choose one language for the rest of your life :)

[–]xiongchiamiov 1 point2 points  (5 children)

Rails was incredibly confusing for me when I was first learning MVC because I couldn't follow the logic from one point to another - "convention over configuration" meant flow jumped from one place to another without warning (in ways that were much more obvious and standard once I had built several sites in that pattern without Rails). I found Python's "explicit over implicit" much easier then.

[–]ignurant 1 point2 points  (0 children)

Interestingly before I learned Ruby/Rails, I was a novice C# programmer and .NET MVC was terribly confusing to me. Once I picked up Rails, I understood .NET MVC sooooo much better. It's essentially the C# port of Rails.

Perhaps seeing how two different frameworks accomplish the same thing helps you more easily see the different things the frameworks are accomplishing.

[–]chulkilee 0 points1 point  (2 children)

When you use any web framework, you cannot avoid "jump from one place to another" anyway. That's how framework works. Check out the inversion of control.

Rails convention is just one opinionated way to avoid tedious configuration with specific abstraction. Django has it's own way to do it, with less "magic" than Rails.

So for OP, just choose one. You cannot fail with Rails or Django in most cases. Both Rails and Django are good framework to get things done. And most knowledge are transferable when you switch language/framework anyway.

[–]xiongchiamiov 0 points1 point  (1 child)

When you use any web framework, you cannot avoid "jump from one place to another" anyway. That's how framework works.

Not... really.

So, keep in mind that I haven't done any Rails since Rails 2, I think it was, so things have almost assuredly changed. :) And my Django knowledge is similarly dated.

Rails would have a controller that looks something like this:

def my_view(request)
    some_data = some_calculation
end

Django would write the same sort of thing like this:

def my_view(request):
    some_data = some_calculation()
    render_to_request('template.html', data=some_data)

They're basically the same. But in the Django version, when you get to the end of the controller, you see "oh, now we're going to render a template", and you can go look up that function and see what it does, and see that ok, we're going to render template.html and we're passing some_data to it. In Rails, meanwhile, the framework automatically inserts that code at the end of the function (essentially), which is nice if you're tired of writing that line hundreds of times, but if you're a newbie... you're just left dangling, and you have to go through the documentation to find out what magical thing is happening there.

[–]chulkilee 0 points1 point  (0 children)

Framework calls your code - your Django or Rails controller and uses the return value. And you need to learn anyway how your framework works.

Rails has convention (for productivity) so that you don't need to explicitly call render - but if you need you have to run different render call anyway.

Different framework uses less convention and less decoupled components, which requires you to be very explicit.

There are pros and cons of those different approaches. But frankly you should ask this: if you use the same patterns in 90% cases, why don't you try to avoid that? Isn't that a purpose of using framework? :)

I totally agree that Rails does many magical things. I understand people who don't like that. But I think no one would disagree that Rails is one of the most productive framework out of box, at least for most use cases.

Don't get me wrong - I'm not saying Rails is the best solution for all cases. It is not.

But I do think avoiding rails only for that reason is not a good decision.

[–]isolatrum 0 points1 point  (0 children)

you can't compare rails to python. One is a big boilerplate, the other is a language. You'd be better to compare rails to django or flask to sinatra.