Sign in to follow this  
nomadph

[web] ruby on rails

Recommended Posts

i haven't tried this, but how come it's not that popular as compared to php? just curious. anyone knows what are advantages/disadvantages of ruby on rails and php-mvc framework? thanks!

Share this post


Link to post
Share on other sites
I don't know much about them, but I think that Ruby-on-Rails is much more oriented towards MVC than PHP. And it's not as popular because it has only recently begun getting attention. It went from something I had never heard of a year ago, to something that has many books in Barnes and Noble now, so I think it's gaining steam (from an "outsiders" perspective).

Here are lot of pages that appear to address the question, though. It seems to be asked a lot, which is further evidence that Ruby-on-Rails will become even more widely used.

Share this post


Link to post
Share on other sites
Ruby on Rails is much, much quicker and easier to use than any PHP framework. The language is more powerful, the querying of objects is easier, the layout is typically cleaner, and overall your speed of development will be much faster.

However PHP can be deployed almost anywhere, so finding hosting will never be a problem, unlike with RoR. And you can get into PHP far more quickly, given that it can be embedded directly into your HTML. The learning curve is negligible. However you start to lose both those 'benefits' when you move to using an MVC framework with it. It also lends itself to those who come from a C, C++, or Java background as the syntax is similar, although many would argue that such a syntax is a poor choice for high-level applications. PHP has a larger community than RoR so finding help is easy. The docs are thorough too.

Share this post


Link to post
Share on other sites
Well, standardization seldomly is an effect of how good a product really is. I guess Ruby just didn't receive as much publicity and was not seen as a language suitable for driving web applications in the beginning.

Also, PHP is more mass-compatible in its feature set, which has, granted, caused most of the PHP community to remain in the procedural programming stone-age. Ruby, on the other side, enforces modern OO design and only attracts a selected few knowledgeable web developers.

At least imho that are the causes why we every other web application is written in PHP instead of Ruby.

--

I think Ruby on Rails provides a great great productivity gain and is a fantastic framework that's probably way over the head of most PHP MVC frameworks.

However, there also are comparable PHP frameworks, Mojavi and its fork, Symfony, for example, that make excellent use of PHP5's capabilities. Combine that with Propel and Creole for database abstraction and PHP can almost stand up to Ruby/RoR.

-Markus-

[Edited by - Cygon on September 7, 2006 1:11:58 PM]

Share this post


Link to post
Share on other sites
Quote:
Original post by Cygon
I guess Ruby just didn't receive as much publicity and was not seen as a language suitable for driving web applications in the beginning.

If anything, RoR has driven an increase in the popularity of Ruby. Ruby is not a bad language; I just don't like some of the philosophical approaches taken by the language designers - a certain laxness and willingness to break existing code in order to fix anything seen as a mistake without a deprecation mechanism, for instance.

As for Ruby on Rails specifically, it's great if you're doing one of the things it was designed for - common web application tasks like building a forum, blog, image gallery, etc. It crumbles into an incomprehensible mess (like all frameworks, so this is not a knock on RoR in particular) when you're doing something irregular, unexpected or new.

Share this post


Link to post
Share on other sites
Well, I do have experience with Ruby, as well as Ruby on Rails. I have written entire websites that utilize a MySQL database in a weekend. The prototyping speed is amazing, as well as the built in unit testing capabilities. As well, the whole system is modelled around MVC, so it is very easy to understand what is going on.

Personally, to me PHP is a mess of spaghetti. I picked up RoR in a month or so, and have never looked back. I definitely recommend you check it out.

To be realistic though, hosting is sort of an issue -- so if you don't want to host yourself or want a lot of choices, don't choose RoR.

[Edited by - visage on September 7, 2006 12:44:25 PM]

Share this post


Link to post
Share on other sites
Quote:
anyone knows what are advantages/disadvantages of ruby on rails and php-mvc framework?

Ruby on Rails is clean. It might not do everything you want, but it's well thought out and organized. It fits the language.

Beware of Rails clones for PHP. Rails does not translate very well to PHP. They are two very different languages. So if you were to use a framework for PHP, make sure it is really designed with PHP in mind.

Quote:
Personally, to my PHP is a mess of spaghetti

PHP is only as messy as you make it. The actual PHP language is very simple and straightforward. Yes, it does suffer needlessly from inconsistent APIs, but that's not very important in the grand scheme of things. Ideally with PHP, you build your own mini-framework that abstracts those calls. Working directly with any first level API is not good practice.

However, I would agree with you if you had said that most PHP applications are a mess of spaghetti. There's a major lack of self discipline among PHP coders. I don't really blame PHP. It's just so simple, it attracts the worst programmers. And that's why I think it is more popular than Rails. Not because it's better, but because it's just more simple. The Rails framework isn't really that hard either, but it only takes hours to get PHP up and running. It can take weeks or months before you are really comfortable with Rails.

I don't believe that PHP is as suitable for MVC as Ruby. PHP 5's OOP is good, but only in the traditional C++ sense. It's poor OOP for a scripting language, while Ruby's OOP is great. I think PHP will eventually lose out to more graceful languages, especially as they become more optimized (opcode caching, etc) and more widely supported.

Share this post


Link to post
Share on other sites
Quote:
Original post by Oluseyi
As for Ruby on Rails specifically, it's great if you're doing one of the things it was designed for - common web application tasks like building a forum, blog, image gallery, etc. It crumbles into an incomprehensible mess (like all frameworks, so this is not a knock on RoR in particular) when you're doing something irregular, unexpected or new.


I can't quite understand how you come to this conclusion. As I see it, RoR is not comparable to a CMS that breaks down as soon as you need something exotic. It just helps you interpret and react to http requests, validate inputs, access a possibly database driven backend and generate the resulting pages.

-Markus-

Share this post


Link to post
Share on other sites
Quote:
Original post by Cygon
Quote:
Original post by Oluseyi
As for Ruby on Rails specifically, it's great if you're doing one of the things it was designed for - common web application tasks like building a forum, blog, image gallery, etc. It crumbles into an incomprehensible mess (like all frameworks, so this is not a knock on RoR in particular) when you're doing something irregular, unexpected or new.

I can't quite understand how you come to this conclusion. As I see it, RoR is not comparable to a CMS that breaks down as soon as you need something exotic. It just helps you interpret and react to http requests, validate inputs, access a possibly database driven backend and generate the resulting pages.

It's a framework, not a library. The difference between the two is that a framework occasionally calls your code to respond to specific events, while your code occasionally calls a library to do specific things. With a framework, there are several assumptions such as the order in which certain events are processed. It is possible to alter those assumptions, but takes a disproportionate amount of effort compared to the majority of tasks handled with the framework.

Like I said, it's a trait of frameworks generally and not a knock on Ruby on Rails. Every framework I've ever seen/used has this problem: MFC, WTL, wxWidgets, wxPython, Qt, WinForms, RoR...

Share this post


Link to post
Share on other sites
Oluseyi is correct.

Rails just happens to target the problems that you are trying to solve: creating small, general purpose web applications. And don't get hung up on the word "small." It's a huge market. That's why you don't think of Rails as a limiting framework.

Share this post


Link to post
Share on other sites
so let's say (assuming none exists yet, and i want to make things from scratch) i want to create a CMS like PHPNuke or PostNuke or Mambo (assuming i want to do it from scratch!), would you recommend me to go the PHP way (MVC or non MVC?) or Ruby on Rails?

thanks.

Share this post


Link to post
Share on other sites
I'd say, by all means, go for a MVC framework. The experience is just so much more rewarding than building directly on top of the language's environment.

As for Ruby vs PHP, that's a hard decision. The Symfony project I mentioned before is exceptionally well written and not just an attempt to port RoR, so it all comes down to the language. PHP is more widespread and Ruby is the better language.

You might even want to try MonoRail, a Rails framework for .NET. I've been playing with this using apache, mono and mod_mono (or xsp) on gentoo linux for a while.

-Markus-

Share this post


Link to post
Share on other sites
Quote:
Original post by nomadph
so let's say (assuming none exists yet, and i want to make things from scratch) i want to create a CMS like PHPNuke or PostNuke or Mambo (assuming i want to do it from scratch!), would you recommend me to go the PHP way (MVC or non MVC?) or Ruby on Rails?

thanks.


Do you want to get it working or to learn about the language? If you just want to get it working RoR will get you there faster. Either php or ruby sans rails would be great for learning the languages.

Share this post


Link to post
Share on other sites
Well time to jump on this before it closes

Ruby on Rails is really 3 core technologies working together with a database:
1. Ruby
2. eruby
3. Rails

With 1 being the programming language, 2 being the embedded in html version of the language and 3 being the framework, you should be comparing php to #2 not 3 as the levels 2 and 3 are for different purposes.

One of the reasons Ruby isn't as popular as php is that traditionally there has been a language barrier as Ruby is primarily developed in Japanese. In my opinion I like it a whole lot more than PHP's messy syntax and inconsistant API's

Share this post


Link to post
Share on other sites
alright i've been into ruby on rails for a few days...

i read this somewhere but forgot where, and so don't know how to do it...

assume i have added a blog post, i'd like to display time i posted as: "5 hours ago", or "3 weeks ago"...

how do i do this? i know you get the difference of time added and current time...but there is a library (i think) that i read that could show it in this string format (like "8 days ago")...

thanks!

Share this post


Link to post
Share on other sites
hi,

i have no problems getting the difference of the date/time...i have problem in showing it in a format of: "3 hours ago" and such (like in youtube)

how to do this in ruby on rails?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this