So have you played with Ruby or Rails yet? No? Well you might want to give it check it out. The Ruby language is very interesting and Rails, which is built with Ruby, is a very powerful web application development framework.
To get you started take a look at these sites:
http://www.rubyonrails.org/ - All about rails.
http://www.ruby-lang.org/en/ - All about ruby.
Then you should check out the fifteen minute hands-on tutorial here. This is a great overview of the language and will get you started. If you are interested and want to get an environment set up, there are instructions on rubyonrails.org for various platforms. The only additional tool I would recommend is RadRails from Aptana, especially if you are already familiar with Eclipse.
Ruby is a dynamic, duck-typed, programming language. Firstly take a look at this:
class Dummy
end
dummyA = Dummy.new
Dummy.send(:define_method, :hi) do
print "Hello world!\n"
end
dummyA.hi
~/ruby$ ruby dynamic.rb
Hello world!
Here we have dynamically defined a method on Deal called hi. Pretty straight forward. Now combine this with method_missing, which is called when... you guessed it.. you call a method on a class that doesn't exist.
class Dummy
def method_missing(m, *args)
puts("There's no method called #{m} here please try again.")
end
end
So now we have a way of creating new methods dynamically, and also knowing what the user tried to call and being able to intercept those calls. So when the user does something like this:
User.find_by_name_and_email('someone', 'someone@test.com')
You can generate the find_by_name_and_email method to go look up the database, find a user table, look to see if it has columns called name and email, and then do a query. This ability gives Rails incredible power to make life easier for the developer as I am sure you can appreciate.
Submitted by Armin on Sat, 2008-01-26 04:59
radoshi | Fri, 2008-08-01 16:19
I really don't like ruby. The language is waaay too liberal in allowing all sorts of things to pass without explanations. Rails makes things worse by adding so much magic to the whole deal - just name your variables and things some way and magic will happen. I *hate* magic. Debugging magic is impossible.
Python/Django all the way dude. No magic in the language, no magic in the framework - it all makes sense and moreover you can read anyone's python code and understand it (unlike ruby).
- Login or register to post comments
»