From: Ammar Ali Date: 2010-11-15T21:31:25+09:00 Subject: Re: Ruby Vs PHP On Mon, Nov 15, 2010 at 11:45 AM, James Vince wrote: > PHP has more lines of code in the actual File than ruby. If you take a > controller (in Rails) and compare it to a PHP program, PHP has more > lines of code. However Ruby has libraries to do most of this code for > you, if you include the libraries that you use Ruby has much more lines > of code. This is not entirely true. PHP does not have a "standard library", instead all functionality is either built into the interpreter or comes in an extension. If you take PEAR into account then the higher number of LOCs that is characteristic of PHP will change the picture. As for frameworks, Zend looks pretty bloated to me for what it does. Rails might be bigger, LOC wise, but it does a lot more too. > But because people who program Object Oriented Code tend to consider > library code to not part of the actual program (as it is part of the > API) they see it as "the actual code you write is less". I believe Ruby's libraries tend to have less code than PHP's libraries. Even though I don't have numbers to back this up, I have a hunch that mixins in Ruby, which PHP doesn't have, play a role in reducing the LOC count in libraries. > Having large libraries of code (coupled with the fact that Ruby has a > slow interpreter) does make Ruby somewhat slower performance wise, > however a Ruby programer would argue that because Ruby language is more > efficient that PHP by re-using code and by using symbols where necessary > instead of strings that makes up for it's slow rendering time. Large libraries of code do not necessarily mean lower performance overall. Ruby's parser is very fast, and once the is code loaded, and cached by the OS/FS, the effect of it's size on performance is negligible. Unless the code is being reloaded on every rendering request, of course, which should not be done if one is concerned with performance. Regards, Ammar