Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Just a quick question..

I can never get a definitive answer when googling this, either. Some people say you can learn Rails without knowing any Ruby, but at some point you'll run into a brick wall and wish you knew Ruby and will have to go back to learn it..and some say to learn the "basics" of Ruby before learning Rails and it will make your life that much easier..

My current knowledge is low. I'm not a beginner, but I'm not pro, either. I went through the Learn Python The Hard Way online book in about a month, but I stopped once I got to the OOP side of Python (I know booleans, elif/if/else/statements, for loops, while loops, functions)

I agree with learning the "basics" of Ruby before learning Rails, but what exactly are the "basics" of Ruby? Would I need to learn the whole OOP side of Ruby before I went on to Rails? Or would I just need to learn the Ruby syntax up to where I learned Python (booleans, elif/if/else/statements, for loops, while loops, functions) before I went on to Rails? Thanks!

share|improve this question
    
Ruby and Python are both multi-paradigm languages, and don't require OOP skills to use effectively. Rails contains some level of OOP but the interfaces you would be writing are not difficult to utilize without knowing the ins and outs. –  Jordan Jul 25 '12 at 7:18
1  
I'd argue that learning Ruby without understand OOP would be a bad move. Even if you might not think you're creating objects, you are, because everything (with only a very few exceptions) is in an object. That being said, I think learning object oriented principles is actually easier coming into Ruby than C++ or Java. –  KChaloux Jul 25 '12 at 16:12
    
Rails doesn't contain "some level of OOP". Every model is an object with methods, every controller is an object with methods. What Rails gives you is an established, controlled pattern that you must apply to your objects, saving you the trouble of figuring one out yourself. –  philosodad Sep 8 '12 at 17:26
add comment

6 Answers

You can learn both at the same time. To learn Ruby, you will have to write Ruby code. You may as well be writing a Rails application as anything else. I had a copies of Programming Ruby and Agile Web Development with Rails. I skimmed Programming Ruby to get an idea of the language, then started following the tutorial in AWDWR.

share|improve this answer
add comment

Most people would recommend that you finish reading a book about Ruby first before moving into Rails, but if you already have a solid understanding of basic programming concepts from other languages (such as OOP, control flow, etc.), you can study Rails and just pick up Ruby along the way.

Most Rails books that are aimed for beginners assume that the reader doesn't have knowledge in Ruby, so they tend to have a chapter dedicated to teaching the syntax of Ruby. Your mileage may vary. The key is to just dive in and see what works for you. You can study Rails right away and then study Ruby if you're having a hard time or you can go with plain Ruby first until you're comfortable enough to take on Rails.

If you ask me, I suggest you study Rails immediately since your motivation to study is to build web applications anyway. You'll lose motivation if you study just Ruby since it takes a pretty long time to finish a book and be fairly adept in the language.

share|improve this answer
add comment

I am very happy that I went Ruby, Sinatra, Rake, then Rails.

Sinatra is a very useful micro framework that you will keep using even after you master Rails. Rake is an integral piece of Rails and understanding it prior to diving into Rails is beneficial.

I would suggest a similar route to anyone else.

share|improve this answer
add comment

If you only learn conditionals, booleans, loops, and functions, you can get a certain amount of stuff done. And probably, yes, you can get things done with just that knowledge. However, most of the code you write will be very procedural because you won't know anything other than those procedural constructs. If you start writing a lot of recursive functions, one could argue you would be stepping up your knowledge.

However, if you really want to learn to program then you need to learn much more than just those things.

share|improve this answer
add comment

First, a caveat: there is no definitive answer to this question.

Rails is more than just a framework. It's a Domain Specific Language separate from Ruby, with its own keywords, culture, and idioms. A primary function of the Rails DSL is to hide things from you. Rails handles the abstraction between a model and the database, for example, so that you don't have to write a data access model. So in this sense, Rails is simpler than Ruby–if you had to build a web application without Rails, you would have a huge amount of work to do.

On the other hand, every syntactically correct Ruby statement is a syntactically correct Rails statement. So the application logic that you write in Rails is Ruby, which is one reason people might say that you are going to regret not knowing Ruby. Rails implements a lot of Ruby's metaprogramming features, so knowing what is actually going on in your Rails app requires some fairly advanced Ruby knowledge.

Another point is that the Rails framework implements the Model/View/Controller design pattern. Models are objects. Controllers are also objects. You simply can't implement Rails without writing objects and calling methods on those objects. Most of what you do in a Rails app is write methods. If you don't know what an object is, or what a method is, you might struggle with this. It might be good to understand objects before you try to understand a particular pattern of objects. On the other hand, it might be good to get a strict introduction to how to use a very specific pattern of objects before you try the general case.

On yet another hand, in my own experience as a guy who doesn't know Rails, not knowing Rails is not much of a barrier to writing applications using Rails. It's probably a barrier to writing good, well-designed applications in Rails, but if you know Ruby well, you can hack something together using any Ruby framework.

All of that said, the advice I would trust most on this is the advice at the Rails Tutorial Book website. The best piece of that advice is this:

a surprising number of beginners have used this tutorial to learn web development, so I suggest giving it a try

If you get lost, go back and learn some Ruby, or some HTML, or whatever you're lost on, and try again! Learning Rails first isn't going to stop you from learning Ruby later, and if you find that you need more Ruby, you can always put Rails down and pick it back up. There's no wrong way to do this–do whatever keeps your enthusiasm for learning up, and whatever keeps you moving forward. Expect this to be pretty hard, though, whatever route you take. If it was easy, they wouldn't pay us to do it.

share|improve this answer
add comment

In Ruby, I would consider OOP as a part of basics, because in Ruby, everything is an object. Definitely learn OOP (how to create a class, how inheritance works, class vs. instance methods, initializing objects...) before learning Rails. And modules - knowing how to create namespaces.

If you know Python, you should be able to pick up Ruby syntax in no time, it's very, very similar.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.