CSC/ECE 517 Summer 2008/wiki2 1 mf: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 20: Line 20:
=== PHP ===
=== PHP ===
* Availability of code snippets, assistance, and documentation - PHP is a much more popular and widely used language than Ruby on Rails. With that comes the huge advantage of a large developer base: near limitless help and support for a problem that some else has much more than likely already experienced.
* Availability of code snippets, assistance, and documentation - PHP is a much more popular and widely used language than Ruby on Rails. With that comes the huge advantage of a large developer base: near limitless help and support for a problem that some else has much more than likely already experienced.
* Like MVC? - If you like the MVC architecture then guess what, PHP has that too. Because of the huge user base many people have derived their own frameworks like [http://www.cakephp.org/ CakePHP] that provide you what you think you may miss by straying away from Rails.
* Like MVC? - If you like the MVC architecture then guess what, PHP can have that too. Because of the huge user base many people have derived their own frameworks like [http://www.cakephp.org/ CakePHP] that provide you what you think you may miss by straying away from Rails.
* More control - with PHP you are not stuck trying to make your application fit a framework. You can make you application do what you want however you want to do it. If you are good at what you are doing you can still have beautiful code without a strict framework trying to get you to design/develop properly.
* More control - with PHP you are not stuck trying to make your application fit a framework. You can make you application do what you want however you want to do it. If you are good at what you are doing you can still have beautiful code without a strict framework trying to get you to design/develop properly.
* PHP looks familiar - Know C, C++, or Java? The syntax is very familiar in PHP which makes the switch very easy. Know *nix commands? A lot of them are functions in PHP that do what you'd think that they do. This makes ramp-up time in PHP very quick for an already seasoned programmer and/or *nix user.
* PHP looks familiar - Know C, C++, or Java? The syntax is very familiar in PHP which makes the switch very easy. Know *nix commands? A lot of them are functions in PHP that do what you'd think that they do. This makes ramp-up time in PHP very quick for an already seasoned programmer and/or *nix user.

Revision as of 02:48, 24 June 2008

Ruby vs PHP

While Ruby is fast growing in popularity, there are still more PHP Web applications communicating with MySQL dataases. Compare Rails with support for Web applications in PHP. Which are the advantages of each for the developer? For the finished application?

An unfair comparison?

I feel that I must start off with a cliche comparision: comparing Rails to PHP is like comparing apples to oranges. Heard that one too many times? Well it definitely applies here. With straight quotes from the front pages of their respective web sites I will demonstrate what I mean:

  • Rails - Ruby on Rails is an open source web framework...
  • Ruby - Ruby is a dynamic, open source programming language...
  • PHP - PHP is a widely-used general-purpose scripting language...

What needs to be stressed is that Rails is a framework and PHP is a language. Because of this discrepancy, many of the comparisons made in this document are not Rails to PHP comparisons, they are Ruby to PHP comparisons. Luckily this doesn't derail us too much. (horrible pun intended) And now we can proceed with the topic at hand.

Advantages for the developer

Ruby on Rails

  • Rails is easy to develop - With so many common features built in and a very logical language set Ruby on Rails is one of the easiest languages to pick up out of the blue and rapidly develop.
  • Ruby code is nice and concise - Many operations that take multiple instructions in PHP can be done with one in Ruby. Best example: iteration.
  • The framework takes care of a lot of the thinking for you - Model handles database interaction, check. Controller handles processing of input stimulus, check. View provides the interface, check. It is incredibly plainly set forth how to build a Rails web application.
  • Ruby is the epitome of OO - Everything in Ruby is an object, everything. Ruby was specifically built around this principle. This doesn't seem too big a deal unless it is also pointed out than many PHP sites still employ PHP4 which is very outdated and its OO support is shoddy at best.

PHP

  • Availability of code snippets, assistance, and documentation - PHP is a much more popular and widely used language than Ruby on Rails. With that comes the huge advantage of a large developer base: near limitless help and support for a problem that some else has much more than likely already experienced.
  • Like MVC? - If you like the MVC architecture then guess what, PHP can have that too. Because of the huge user base many people have derived their own frameworks like CakePHP that provide you what you think you may miss by straying away from Rails.
  • More control - with PHP you are not stuck trying to make your application fit a framework. You can make you application do what you want however you want to do it. If you are good at what you are doing you can still have beautiful code without a strict framework trying to get you to design/develop properly.
  • PHP looks familiar - Know C, C++, or Java? The syntax is very familiar in PHP which makes the switch very easy. Know *nix commands? A lot of them are functions in PHP that do what you'd think that they do. This makes ramp-up time in PHP very quick for an already seasoned programmer and/or *nix user.

Advantages for the finished application

Ruby on Rails

  • Rails is easy to maintain - Sharing quite the same reason as being easy to develop, Rails is very readable and easy to pick up. You can eyeball code and know what it does. The framework also aids in this because you know exactly where to look for the functionality that you need to add to or revise.

PHP

  • PHP scales
  • PHP is faster - Yes, this is different from scaling.
  • PHP is easier to deploy - It is actually rather difficult to find a hosting service that does not support PHP. While some may only have PHP4 support, most hosts support PHP5. When the time comes it is also very easy to move from you development system to a host. Rails hosting? What is that?

References