views:

164

answers:

4

I assume that for all of these i need to get a better understanding of Ruby itself but does (say) Padrino translate directly into skills i would use in Rails or is it indirect.

I am a PHP programmer but as i have used PHP frameworks which are clones of Rails i am finding it not too difficult

A: 

Padrino is based on Sinatra, which in turns is based on Rack which is also the same ruby web server interface implemented in Rails. So yes, they have some common features, but no, learning Sinatra won't help you much in learning Rails if you don't learn Ruby before.

If you have used web frameworks before you are already familiar with MVC, templates and models. What you need to know now is the framework specific syntax so you need to work directly with the framework you want to learn.

Rails and Sinatra shares some common principles and habits which belongs to the Ruby ecosystem. But you would need to learn Ruby before in order to better appreciate these frameworks.

Don't assume the "learning Ruby" step to be an optional task.

Simone Carletti
Thanks, initially i thought i could 'avoid' Ruby but with what i have done so far i can see it is integral not only for the actual coding but for the 'Ruby Way' concepts as well
PurplePilot
Trying to work in Sinatra or Rails without knowing Ruby would be extremely difficult. All you could really do is generate basic erb or HAML templates and maybe write basic routes. Moving beyond the basics would require understanding how Ruby handles loops, variables, how to create classes, talking to databases or reading files, etc. Once you know Ruby you'll see how it influences Sinatra and Rails and things that were confusing will become clear. I tried to learn Rails without knowing Ruby, and it was really confusing until my Ruby knowledge improved.
Greg
+2  A: 

This might be a more controversial opinion, and I'll admit to being new to both still, but as someone who just spent a week on Sinatra and then moved on to Rails, I would recommend going straight for Rails. Initially, it will seem like there's a lot more to learn about Rails, but if you're going to write something moderately complex, you're going to move to Rails eventually, and it's less work 'unlearning' from Rails what you need to write a Sinatra app than it is to relearn things to do it the Rails way. You save yourself the pain of having to shift gears when it turns out that your project you started in Sinatra was best done in Rails after all (which happened to me).

This does mean it's going to take a little longer to get up to speed on Rails. I recommend starting with Michael Hartl's tutorial and the official guides. However, my advice is specifically geared towards existing developers who already know how to develop web apps and are more likely to have more complex projects in mind than beginners. Someone brand new to web app design may very well appreciate the immediate gratification that building a basic Sinatra app will offer, but that doesn't seem to be you.

Experienced developers will probably argue that you can definitely write 'moderately complex' apps in Sinatra too, and they will be right. I think Sinatra's strengths are in being a fallback for experienced developers who want to knock out a quick app without Rails 'overhead', and not as an introduction to Ruby/Rails based web app development.

Joost Schuur
Thanks. As a supplementary question i nearly asked, but it was a bit fuzzy, was how soon do you run out of steam on Sinatra and Padrino and need to go to the full Rails? And think you answered this in that experienced Rails devs can use the S and P tools to perhaps Proof of Concept without the full Rails baggage and then 'upgrade' with Rails?????
PurplePilot
Me moving on to Rails had more to do with me realizing that eventually I would want to learn full blown Rails than hitting an immediate technical limit. I was quickly creating a number of different views, subdividing my code into different individual files that the main file included and at 15 files, started to wonder why I wasn't just using full blown Rails, when a 3 day old project already branched out this much. Sinatra just appeared too lean for the job, especially after I saw that the main .rb files for it were barely 75k in size.
Joost Schuur
I think an experienced developer would have a better feel for what tools is suitable for what app and pick the right one before they started, so they wouldn't have to switch from Padrino or Sinatra to Rails later.
Joost Schuur
A: 

You can't skip the step to learn ruby, because every ruby MVC extend it and If you have to do some important customization/optimization you'll do it in ruby.

My advice is to learn a ruby base (variables, blocks, modules, hashes,..), use Rails in real world, learn Rack and then choose the best "pieces" of the Ruby World that suit to your needs.

grigio
Rack? (the extra words to allow a short comment to be posted)
PurplePilot
Rack is a middleware shared among ruby frameworks, it means that some kinds on interactions can be done in a lower level and shared among ruby frameworks. To understand better the pieces of Rails3 see http://www.slideshare.net/wycats/rails-3-dashing-to-the-finish and http://github.com/rack/rack-contrib for rack
grigio
A: 

If you want to learn rails a good way is to follow the road map that is mapped out on this blog post. It is what I used and it was a great start. Obviously if you already know PHP there are steps that you can most likely skip, but overall it is a really good approach to taking little steps towards learning rails http://techiferous.com/2010/07/roadmap-for-learning-rails/

Danish Khan