I’ve been using PHP for years. In some ways it’s a messy language, but it gets the job done and is widely adapted in the web community. How about another programming language called, “Ruby on Rails”? Let’s have a comparison between the two.
For those not familiar with Ruby (on Rails) I should explain. Ruby is a programming language originally developed in 1993 in Japan by Yukihiro Matsumoto. It is not specifically designed for web applications, but as a general-purpose language. Ruby on Rails is a web framework for Ruby, and it was created in 2005 by David Heinemeier Hansson for Basecamp. I’m using PHP as a comparison primarily because it’s by far the most widely-used server-side scripting language, and anyone with experience in such development is more likely to be familiar with it than any other language. Additionally, I’m pretty familiar with it, so it’s easier for me to write about.
Worth noting is the fact that it’s generally easier to deploy PHP than Ruby on Rails. Almost every hosting company supports PHP, and it’s just a matter of giving your pages a .php extension and putting the code inside oftags. By contrast, Ruby on Rails needs a fairly elaborate folder structure to work, and files aren’t directly accessed by name like .php files (usually) would be. Fortunately the folder structure and default files are generated for you when you create a Rails application, and including Ruby in HTML is still as easy astags. Most prohibitive though, is the fact that RoR is supported by fewer hosts, though it’s not too difficult to find one that does support it.
Rails is excellent at interfacing with databases to directly present data. Classes obtain information from related database tables using very intuitive commands, without requiring specific instructions from the developer to tie them together. Generally speaking a developer won’t need to interact with the database explicitly from within the application. Because of this, it’s great at easily creating blogs, and other applications which involve one or more types of things that will be displayed according to their kind, especially if they have relationships to each other. For example, Twitter’s web site front end is built on Rails. It has users, tweets, lists, etc, and a unified way to access each type of object. Conversely, if you have a website with several distinct pages (Home, About Us, Contact, etc) and no duplication of objects, you might be better off using PHP, and just building the pages in place.
There’s way too much for me to adequately cover the language. If you’re interested, try the Ruby’s official documentation as well as the tutorial on tryruby.org followed by Rails for Zombies, I highly recommend that path for newcomers to the language/framework. Ultimately, in my opinion, Rails is incredibly good at what it does, and not so incredible at other things, whereas PHP is really easy for small interactions but can take more work for larger applications, and is pretty good at getting just about anything done server-side.