How is Ruby on Rails better than php?

I'm currently learning through a Sitepoint Ruby on Rails ebook and it
is extremenly good.
But the ebook is taking long to read, and RoR is taking ages to learn.
I've passed 242 out of 447 pages.

Why is Ror better than php? Is it worth spending my time learning it
if I already know php?

Hi desbest,

We can't compare php and RoR. RoR is a framework based on ruby. Php is
just a programming language like ruby. So you can compare php with
ruby or RoR with a php framework (Symfony, phpCake ....).

B.

Alright then, Ruby on Rails compared with CodeIgniter for php
http://codeigniter.com .

I can’t understand why RoR is taking you so much time to understand when you’re familiar CodeIgniter, they are so clearly related. Except maybe for the fact that RoR’s code is so much more natural and the framework is a lot more evolved than CI.

If you’re fluent in CI (or Symphony or CakePHP for that matter), making the step to Rails should be like moving from a latrine to a nice house. It might seem big and daunting at first, but at least you don’t have to cope with all the smelly stuff you produced and you’ll feel right at home after moving in some of your furniture (i.e. have done a small project in it).

Best regards

Peter De Berdt

I think that the PHP frameworks closets to RoR are

- CakePHP (www.cakephp.org)
- Akelos (www.akelos.org)

CodeIgniter is good, but it misses quite a bit of stuff in order to be
as close as the other two above to RoR.

Dan

I think you are asking about the costs and benefits of writing a site
in Rails, as compared to PHP.

My experience is that being familiar with PHP makes learning Rails
quite tiresome at first. The problem is that every single task seems
to require a lot of learning about the whole system. This leaves you
wondering why you don't just write a few lines of PHP, instead of
reading a chapter in a book. This circumstance arises precisely
because the Rails is so powerful, because it can handle so many tasks.

It's a bit like being very familiar with a swiss army knife, which can
handle a lot of tasks somewhat awkwardly, and then being handed a few
dozen specialized tools that require new learning. Yes, it's a pain
at first. But things will start to pay off eventually.

The great thing about Rails is that things come "for free". Instead
of writing a quick PHP hack and later having to go back to strengthen
the method or fix a problem, you can rest assured that what you've got
(when you finally have it) will be fairly powerful.

I think maintaining Rails should be easier than maintaining Rails.
However, you'll need to keep abreast of Rails changes as they
develop. That's a bit of a pain, unless you like that or can convince
someone to pay you to do it, as the case may be.

I hear repeatedly that Rails is slow compared with PHP, and I have no
reason to doubt that.

Deploying Rails is also a problem for some people. For example, at my
university, tens of thousands of individuals have personal websites.
Anyone can use PHP if they like it better than HTML. Rails is not
supported.

On balance, I would say that it is worth learning Rails, especially if
you enjoy Ruby. Your second and third applications will be a lot
faster than the first one. Soon you'll find it all quite natural.

But if you just want to get work done, and if you know PHP well enough
to do that, why not just get that coding done and move on to something
else?

Maybe it’s nice to add the following comment.

A lot depends on the project itself. Rails is suited for web applications and websites that have to handle a lot of dynamic data. If you’re just whipping together a website with very little dynamic stuff and less than a dozen admin views to administer the site, Rails is simply overkill.

Also, if maintainability is a concern, Rails will be a relief if you use the MVC structure well.

Best regards

Peter De Berdt

I think that the PHP frameworks closets to RoR are

- CakePHP (www.cakephp.org)
- Akelos (www.akelos.org)

Discovering new Php Frameworks everyday :slight_smile:
When will they stop ?

B.

Coding with rails is fun. Ruby syntactic sugar is awesome.
I would never like to compare Rails with php. php has proved to be good language.
But… once you get into ROR world, you would never want to switch back to php world.

Learning ROR should not take much time, but mastering … and using full of its features takes time.
As many good developers already said, what matters is your application design not the language.

– Anil

The sitepoint has 264 pages and teaches me Ruby on Rails and how easy
it is to understand.
But it's taking hours to get through the whole book as there is a
whole lot to read and do.
I can show you any pages of the book if you want.
The book covers prototype.js and script.aculo.us, created by a RoR
member.
Covers drag and drop, MVC, Ruby basics, webforms, ajax httprequest,
sessions and cookies and lots more.
I never had to do all this learning while learning php.

Buy the book at http://www.sitepoint.com/books/rails1/?SID=8ea6a608cb21cd7309f053719a45fdb6
you won't be disappointed

Learning a programming language takes time.

Learning OOP vs procedural programming takes more time.

Learning a programming language using OOP design well takes much more
time.

Learning a programming language with a paradigm shift AND a framework
takes much much more time.

Sounds like you are complaining that learning takes time.

Well, yeah it does.

:slight_smile:

I never had to do all this learning while learning php.

It all popped into you head, just like that. Right.

Buy the book at http://www.sitepoint.com/books/rails1/?SID=8ea6a608cb21cd7309f053719a45fdb6
you won't be disappointed

The book is based on Rails 1.2 and is therefore outdated. They might
as well go back to giving it away for free like they were doing a
couple months back. It's not very good anyway.. It's beginner level
stuff that's covered for free in howtos on the Rails wiki and many
Rails screencasts you can find using Google.

I'm not trying to be argumentative, but did you just know how to do everything in PHP? Probably not. More likely is that you learned little bits of PHP here and there, as the need arose. You can do the same thing in RoR. Think of it this way: You have this book in front of you that is written for a wide audience. The intent of the books is to introduce a whole bunch to the reader, so you are going to get all of that stuff "at once". But, hey, you don't have to read the whole thing cover to cover before you can start working in Rails. Just take what you need to get a task done and come back when you need more.

Peace,
Phillip

ive coded a cms script for clans with a templating system and a
downloads, news, private messaging, affiliates feature
i've coded a reciprocal link exchange marketplace where you track your
sites and your link exchanges
and a comic script. i've modified a free cpanel billng script to work
with directadmin i'm also going to create a cms script.

And to ask my question again:

Were you born with the knowledge of how to do all of that? No. Did you sit down one day and "Hi PHP. I'm going to code all of this sophisticated stuff in your right now." No. You started by learning how to do simple things in PHP, then you built on that knowledge to do more complicated things, until you learned enough to combine lots of pieces together into an organized whole that represented something functional.

To expect to sit down with Rails and come up to the same level of experience you have in some other language/framework/environment in no time at all is pure foolishness. I'd love to learn how to play piano, but the last time I sat down at one, it didn't all just come out. So I gave up.

Peace,
Phillip