xenopod
109 posts since
Dec 28, 2007
3.
Re: Ruby on Rails vs. PHP Jun 3, 2008 11:10 AM
Ruby on Rails (RoR) is a framework for web applications. It uses the Ruby which is a full programming language. This means you can write Ruby programs that work on the server interacting with the OS itself instead of the webserver module and send result data back to objects written RoR in the webserver and see the results through a web application.
PHP is a server side scripting language not a full programming language. This limits what PHP itself can do to things you can do inside of your webserver. However this limit isn't different from what RoR can do its own without extensions calling to outside programs. It should also be mentioned that when PHP is linked to a shell it can run arbitrary code in the OS outside of the webserver just like Ruby and RoR can.
With RoR it is considered generally easier to do build multiple things that do similar things since the framework is premised around a notion of "Don't Repeart Yourself" (DRY). This is accomplished by the uses of classes and objects in Object Oriented Ruby.
While RoR can do what the framework was speified to do very well it is tedious and cumbersome to write code within the framework to do something it wasn't intended to do. However similar things can be said about other frameworks for other languages if you learn how to write within a framework and not how to properly program or properly implement in a language.
So how do you pick a preference? Well if you are a web developer and you need to create dozens (or hundreds!) of websites that essentially do the same thing then it would probably make sense to use Ruby and RoR to build all of your websites. Since you could then just copy and paste your code for each implementation and throw on a different interface and only those who can read the script code will ever know they were built using the same code. However, again, it should be said many often already do this inside PHP. If you are a single company building apps and sites for your own company's use then it doesn't really matter what platforms you choose, pick things your programmers already know well so they write the best code possible. Unless they have an excellent background in the theory of programming languages don't make them learn a new language! They already write their best code in whatever language they know, don't compromise quality just to be trendy.
So we'd need to know more about what your specific situation is before I could really refer one or the other to you. Do you already know Ruby or PHP? Are you a web development company or a programmer working for a company that isn't a web development firm? What is it you plan on coding and have you looked into the RoR specification about what it is intended to do?