From: Charles Calvert Date: 2010-11-11T03:50:21+09:00 Subject: Re: Ruby vs PHP for the web On Wed, 3 Nov 2010 20:49:22 -0500, Ruby Me wrote in <1cd601a47b01edd27940e192d7465996@ruby-forum.com>: >I am not here to say that PHP is better or the opposite, I am here to >ask, how web development in Ruby compared to PHP. Does Ruby use the same >tools? for example MySQL and Apache? As others have said, yes. There are Ruby libraries to allow you to use most, possibly even all, of the external resources that you're used to using from PHP. Examples include MySQL, PostreSQL, ImageMagick, encryption libraries, etc. >And the most interesting point, which language can create a web >application with less code? (I am talking about the languges not the >frameworks). That's not really a useful question, as it's fairly uncommon to create web applications without a framework of some sort these days. Having worked with both, I'll tell you why I like Ruby a lot more than PHP. 1. PHP is a poorly designed language that suffers from a number of problems, including design by committee and the misguided effort to "make programming easy for nonprogrammers". Google "PHP sucks" and you'll find plenty of detailed articles enumerating the issues with PHP. Some of these have been corrected (or at least deprecated) in version 5 and more will be corrected in version 6, but others are still there, notably the horrible inconsistencies in the standard library. 2. PHP's support (in version 5) for OO programming is rather anemic. You get single inheritance only; there is no support for multiple inheritance or mixins. While you can use __get() and __set() to implement properties , this is nasty and can lead to huge switch statements on classes of any complexity. The standard library is still heavily procedural. It doesn't support namespaces. Ruby has mixins, which makes multiple inheritance less necessary and properties (called attributes). Namespaces can be faked using modules. Finally, Ruby was designed to be an OO language from the beginning, while PHP has tacked OO features onto a procedural language. 3. PHP uses weak typing, which leads to all sorts of problems with ensuring that code behaves the way that you intended. Ruby uses strong, though dynamic, typing. 4. There are a ton of very cool tools surrounding Ruby that can make your life a lot easier. PHP has many fewer of these. 5. Ruby attracts smart, experienced programmers. PHP attracts people who are new to programming. Don't underestimate this one. If you're going to interact with a community and learn from people, which of these would you pick? -- Charles Calvert | Software Design/Development Celtic Wolf, Inc. | Project Management http://www.celticwolf.com/ | Technical Writing (703) 580-0210 | Research