Rails Vs Php

RubyOnRails is a framework for developing web applications at a quick but sustainable pace, with full support for UnitTests.

PhpLanguage is a server-side scripting language. It is the moral equivalent of one layer of Rails - the eRB EmbeddedRuby? layer. So a fair comparison must invoke the latest modules available for ModelViewController and PersistenceLayer activities in PHP.

I had to edit a PHP application recently, REALLY REALLY simple app. Could have been done with 2 controllers, 2 models, and about 6 Views, probably taking under 100 lines of RubyLanguage. The application... was over 3,500 LOC (the PhpLanguage code only, no HTML), no joke. --RayMorgan?? (reposted from the RubyOnRails mailing list w/o permission)

The above statement seems ignorant of the thousands of lines of Rails code. The writer wrote 100 lines, Rails has many more. Rails ! better than PHP, just different. --BlackHat

That's just it, the "thousands of lines of Rails code" are already written for you, so the programmer only needed to write 100 lines of additional code. Granted this is an unfair comparison, Rails is a framework and PHP is a language, they're not the same thing at all. However, my experience has shown that unless there is a lot of quality control in place PHP developers (IE: average programmers, not the highly skilled ones) will write a program from scratch trying to use the PHP libraries as a web framework and Ruby programmers will jump to using Rails. So the real comparison is Rails vs the PHP libraries that most PHP developers tend to use. Highly skilled PHP programmers will either use a good PHP framework or write a clean, well thought out, framework before starting to code the actual app. --TimCaswell?

Ray may have indeed encountered a PHP application that did not use the available PHP modules to abstract that program's layers. Such programs typically devolve into run-on files that mix and match persistence (PerniciousIngrownSql), and business logic. All inside one HTML template.

There may still be reasons RubyOnRails is "better", for various aspects of "better". One of them is the power of the base language.

Ruby is not "SmalltalkLanguage with the weird syntax taken out." It is indeed a language that supports normal-looking statements, familiar to CeePlusPlus, JavaLanguage, or PerlLanguage enthusiasts. Yet Ruby language permits statements that compete with the highest-end of Smalltalk abuse. For example, everything's an object, and every method is a message. That permits wonderfully message-oriented methods, such as this:

  def foo
returning [] do |values|
values << 'bar'
values << 'baz'
end
  end

foo # => ['bar', 'baz']

returning is a "Ruby-ized realization of the K combinator, courtesy of Mikael Brockman". Ruby allows you to invert syntax, where necessary, to reduce statements and operations. This makes it more scalable.


What is an example of something that Ruby the language does that Php cannot do (or does poorly) that is a significant part of Rail's success? In other words, what prevents a PhpOnRails? port?


An anecdote on rails-vs-php:

http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html

That anecdote does not actually compare rails-vs-php. The Rails project ran WaterFall style, and it played around for years, adding awesome features, before attempting a deploy. The PHP version was nothing but a feature-for-feature rewrite, of an older project, by a guy thoroughly experienced in both PHP and the target applications' needs.

More here:

http://www.oreillynet.com/onlamp/blog/2007/09/big_requirements_up_front.html

The best rails-vs-php comparison, head-to-head, is here: http://railsenvy.com/2007/8/24/rails-vs-php perhaps significantly, this page is now blank


CategoryWebDesign


EditText of this page (last edited June 8, 2014) or FindPage with title or text search