views:

117

answers:

5

First of all, i want some clarification :)

1) Is RoR like a server scripting language?

2) Can it be used as an alternative to php?

I started learning Ruby from The Ruby Programming Language book and haven't yet come across something which relates to the web. Is Ruby for desktop apps and Rails for web apps?

Thanks

+7  A: 

ruby - dynamic programming language
ruby on rails - framework for creating web apps written in ruby

Arnis L.
+3  A: 

Ruby is an all-purpose scripting language. There are GUI toolkits for Ruby, sure.

Rails is a web framework implemented in Ruby, which can be used to develop web apps - as an alternative to PHP.

Leonid Shevtsov
+2  A: 

Ruby is a language - and one that encourages (some might say enforces) object-oriented programming.

Rails is a framework for writing applications and it uses the Ruby language - hence the term "Ruby on Rails".

Sohnee
A: 
  1. Not Really. Ruby on Rails is a web application framework written in Ruby. If you need a comparison, Ruby on Rails is for Ruby what Zend Framework, CakePHP or Symfony are for PHP.

  2. Neither Ruby nor Ruby on Rails are real alternatives to PHP. PHP is a programming language focused on web applications. Ruby is a pure programming language which can be used for creating web applications.

Ruby on Rails offers a more high-level approach for writing web applications with Ruby. Ruby offers some low-level CGI libraries you can use to interact with web servers, but it requires much more effort compared to PHP (because again, PHP is a web-focused language). For this reason, almost nobody writes web application in Ruby without using a framework such as Rails, Sinatra or others.

Simone Carletti
RoR is not written in PHP.
Gishu
PHP is a Scripting language, not Programming language !! just like 'ol ASP!
balexandre
What is the definition of a "scripting language" and what is a "programming language" so you can claim that X is one of them, but not the other?
Emil Ivanov
I disagree with your second paragraph. Ruby alone is not focused on web applications like PHP is, but Ruby with Rails is very much a real alternative to PHP.
Christoffer Hammarström
I don't agree with you in that PHP requires less effort to learn. It's something unmeasurable - too many factors. I could say Ruby is easier to learn since it looks more like plain English than PHP (which looks more like C).
egarcia
The "more effort" was related to the interaction with web server. Ruby requires more effort to work with web server because it doesn't offert built-in server/cookie/session facilities like PHP does.
Simone Carletti
@Emil Ivanov: Typically a "scripting" language is interpreted as it runs, whereas a "programming" language is compiled into an independent binary before it is run.
bta
@bta: So this means that Java is a scripting language - it's compiled to bytecode and then ran.
Emil Ivanov
PHP is a DSL for web servers. Ruby is a general purpose language with strong metaprogramming capabilities that make it suitable for creating DSL's. You could say that Ruby is a DSL metalanguage; RoR is an instance of a Ruby DSL.
Wayne Conrad
+2  A: 
  • Ruby is a general-purpose, dynamic, object-oriented scripting language
  • Ruby on Rails is a web framework that's written in Ruby

Rails' ActiveSupport module also enhances Ruby in certain ways by adding capabilities to some of Ruby's built-in classes. Rails depends on Ruby, but Ruby doesn't depend on Rails.

John Topley