CSC/ECE 517 Summer 2008/wiki2 1 mf: Difference between revisions
(→PHP) |
(→PHP) |
||
Line 21: | Line 21: | ||
=== PHP === | === PHP === | ||
* Availability of code snippets, assistance, and documentation | * Availability of code snippets, assistance, and documentation | ||
* Like MVC? | ** PHP is a much more popular and widely used language than Ruby on Rails. | ||
* More control | ** There is 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. | ||
* PHP looks familiar | * Like MVC? | ||
* More customizable | ** 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. | |||
* PHP looks familiar | |||
** Know C, C++, or Java like many coders do? 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. | |||
* More customizable | |||
** You can build your software a la cart. Take a piece of this code, take a piece from that code, mix, viola! New application! | |||
== Advantages for the finished application == | == Advantages for the finished application == |
Revision as of 21:57, 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.
- Changing databases is easy - Change a configuration file, run a script, done. This is much more involved with PHP.
- The Rails framework is much more organized - 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.
- Rails can make you a better programmer - Because of the rules that Rails enforces you are almost forced to learn proper technique when developing Rails.
PHP
- Availability of code snippets, assistance, and documentation
- PHP is a much more popular and widely used language than Ruby on Rails.
- There is 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?
- 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 like many coders do? 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.
- More customizable
- You can build your software a la cart. Take a piece of this code, take a piece from that code, mix, viola! New application!
Advantages for the finished application
Ruby on Rails
- Rails is easy to maintain
- The framework helps a lot because you know exactly where to look for the functionality that you need to add to or revise.
- Rails is very readable and easy to pick up. You can eyeball code and know what it does.
- Changing databases is easy.
PHP
- PHP scales much more easily
- PHP is less CPU and Memory intensive requiring less hardware to accomplish the same task
- PHP is faster
- PHP has many tools available to take care of caching and code optimization for you
- 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?