[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Ruby vs. PHP

Marcin Raczkowski

10/1/2007 10:52:00 AM

Hello

My company is trying to get big contract for creating and maintaining
HUGE website (nation wide portal). We're trying to convince investor
that Ruby (i don't mean rails) with custom tailored MVC framework is
best solution, we're going to make prototypes in rails FAST, then port
heaviest and most frequently used parts to my custom framework, rewrite
AR into tuned SQL queries etc.

investor was quite impresed with speed of development but of course
there's trouble in paradise .. he hired a consultant :/ - this guy AFAIK
did lot's of work but only in PHP and he is trying to convince investor
PHP is way to go.

could you please help me find some benchmarks comparing speed of PHP vs
Ruby (especially YARV/JRuby, if ound some benchamrks that show Ruby is
slower in interpreter), mayby comparsions of security(in Rails it's
preatty imposible to do sql injections if programmer is carefull enought
to use properly constructed queries).

also I'm open to any arguments(preferable documented, with showcases,
and understandable by investor(who never had much expirience with
computers except for e-mail and www)) that would help convince him that
ruby is much better then php :)

and I'm also looking for big sites that adopted ruby / ruby on rails
(especially with huge number of users / hit's per s)

Marcin Raczkowski

63 Answers

Robert Dober

10/1/2007 11:41:00 AM

0

On 10/1/07, Waleed Harbi <waleed.harbi@gmail.com> wrote:
> http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=ruby&...

This has been discussed a lot on this list, and I believe that a
majority of the community is concerning the shootout site a site
without any value.
For sure I do.

Cheers
Robert

Richard Conroy

10/1/2007 11:51:00 AM

0

On 10/1/07, Marcin Raczkowski <mailing.mr@gmail.com> wrote:
> Hello
>
> My company is trying to get big contract for creating and maintaining
> HUGE website (nation wide portal). We're trying to convince investor
> that Ruby (i don't mean rails) with custom tailored MVC framework is
> best solution, we're going to make prototypes in rails FAST, then port
> heaviest and most frequently used parts to my custom framework, rewrite
> AR into tuned SQL queries etc.

Why is this a good idea?

>
> investor was quite impresed with speed of development but of course
> there's trouble in paradise .. he hired a consultant :/ - this guy AFAIK
> did lot's of work but only in PHP and he is trying to convince investor
> PHP is way to go.

PHP beats Rails in certain aspects; for instance if development of the
site is seasonal in nature, as opposed to continuous, the customer
is likely to be hiring as they need. The large availability of PHP
developers plays in its favour.

> could you please help me find some benchmarks comparing speed of PHP vs
> Ruby (especially YARV/JRuby, if ound some benchamrks that show Ruby is
> slower in interpreter), mayby comparsions of security(in Rails it's
> preatty imposible to do sql injections if programmer is carefull enought
> to use properly constructed queries).

Well none of that is true, or really important. Sure its easier to secure Rails.
But if you are making a large nationwide portal (I am going to assume that
that means you have high activity) then the performance of your rendering
component (PHP or Rails) doesn't actually matter.

PHP isn't exactly assembler speed itself. Ruby is in the same league (slower
with 1.8, faster with YARV). There is a reason that PHP is a central component
in a LAMP stack - probably the solution of choice for websites with high user
load. In principle Ruby can do the same, in practice we have only had
about 2 years
as a community to get big Ruby sites up. You also have an equivalent ASP
stack based on windows components.

All of these stacks are glued together with languages that are at least an order
of magnitude slower than Systems languages like Java.

>
> also I'm open to any arguments(preferable documented, with showcases,
> and understandable by investor(who never had much expirience with
> computers except for e-mail and www)) that would help convince him that
> ruby is much better then php :)

There's plenty of sites out there doing pretty heavy stuff with Rails,
but beyond
Rails there is not much evidence that shows pure Ruby custom web solutions
to scale. Rails has a lot of features and best practices built in to
help it scale.
In a pure Ruby solution you are committing to re-writing all of that
from scratch.

Based on your questions/responses here, I think the consultant is right; that
PHP is a better solution for the customer.

John Joyce

10/1/2007 2:18:00 PM

0

I wouldn't sweat it much.
Show them good sites built with these things. Explain the reasons you
use what you use.
If they hire a consultant who only recommends one technology, then
he's a shill.
He could just as easily be an ASP shill or a Java shill or anything
else.
Ruby and Rails are still small compared to PHP, but booming and not
shrinking.

You might want to show a bit more of the ongoing history of
insecurity that is a lot more rampant with PHP sites, and even
recommend a little security through obscurity. (that's what kept VAX
systems going until HP end-of-lifed the OS)

But in the end, if you don't get it, chances are they'll go with a
cheap and mediocre PHP shop. It's a lot like the cheap and mediocre
Microsoft-based shops. There are lots of them, but there are lots of
bad ones. Good PHP shops are probably more expensive (and busier)
than you.

The truth is, the language used is only one small part of many things
they should be carefully considering. Server (hardware/software) /
web hosting can be as/more important. The language really shouldn't
matter all that much. Google, Yahoo, etc... don't use strictly one
language or framework in house! A decent programmer / team of
programmers should be able to select the technology they feel will
work best for them AND the project together. In some cases Ruby might
be the wrong choice.

Everybody and their dog touts themselves as a nationwide high-traffic
portal site to be, but if that were true or even likely, they
wouldn't need a consultant, they'd have a CTO of some kind who would
have already decided these issues. Sounds more like your selling lawn
care services to a guy from the desert who has only heard of grass
and is planning to build a golf course.

Marcin Raczkowski

10/1/2007 2:27:00 PM

0

Robert Dober wrote:
> On 10/1/07, Waleed Harbi <waleed.harbi@gmail.com> wrote:
>> http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=ruby&...
>
> This has been discussed a lot on this list, and I believe that a
> majority of the community is concerning the shootout site a site
> without any value.
> For sure I do.
>
> Cheers
> Robert
>
>
i found this one, and also it's interprete ruby not YARV or JRbuy

mortee

10/1/2007 3:14:00 PM

0

Marcin Raczkowski

10/1/2007 4:00:00 PM

0

Richard Conroy wrote:
> On 10/1/07, Marcin Raczkowski <mailing.mr@gmail.com> wrote:
>> Hello
>>
>> My company is trying to get big contract for creating and maintaining
>> HUGE website (nation wide portal). We're trying to convince investor
>> that Ruby (i don't mean rails) with custom tailored MVC framework is
>> best solution, we're going to make prototypes in rails FAST, then port
>> heaviest and most frequently used parts to my custom framework, rewrite
>> AR into tuned SQL queries etc.
>
> Why is this a good idea?

why not?
rails is easy to prototype but is painfully slow and hard to optimize, i
know caching is going to play huge role but optimized complex sql
queries are also important

>
>> investor was quite impresed with speed of development but of course
>> there's trouble in paradise .. he hired a consultant :/ - this guy AFAIK
>> did lot's of work but only in PHP and he is trying to convince investor
>> PHP is way to go.
>
> PHP beats Rails in certain aspects; for instance if development of the
> site is seasonal in nature, as opposed to continuous, the customer
> is likely to be hiring as they need. The large availability of PHP
> developers plays in its favour.
>

possibility of continous development is one of strong points of rails,
and that's why i'm advertising it, code writen by that large group of
php developers is usually unmaintainable. I had plenty of expirience
with php and i know how strangely can be php written, and rails forces
good practices like MVC, and ruby i much cleaner langue then php to
begin wth

>> could you please help me find some benchmarks comparing speed of PHP vs
>> Ruby (especially YARV/JRuby, if ound some benchamrks that show Ruby is
>> slower in interpreter), mayby comparsions of security(in Rails it's
>> preatty imposible to do sql injections if programmer is carefull enought
>> to use properly constructed queries).
>
> Well none of that is true, or really important. Sure its easier to secure Rails.
> But if you are making a large nationwide portal (I am going to assume that
> that means you have high activity) then the performance of your rendering
> component (PHP or Rails) doesn't actually matter.

if it's easier to screw up in PHP with security, then here it's REALLY
important, try to imagine hacker group logo in something like msn/yahoo
main page

>
> PHP isn't exactly assembler speed itself. Ruby is in the same league (slower
> with 1.8, faster with YARV). There is a reason that PHP is a central component
> in a LAMP stack - probably the solution of choice for websites with high user
> load. In principle Ruby can do the same, in practice we have only had
> about 2 years
> as a community to get big Ruby sites up. You also have an equivalent ASP
> stack based on windows components.

what is the reason? php was never solution of choice for high-load or
professional websites, it was promoted becouse suposed ease of use and
installation

>
> All of these stacks are glued together with languages that are at least an order
> of magnitude slower than Systems languages like Java.
>
>> also I'm open to any arguments(preferable documented, with showcases,
>> and understandable by investor(who never had much expirience with
>> computers except for e-mail and www)) that would help convince him that
>> ruby is much better then php :)
>
> There's plenty of sites out there doing pretty heavy stuff with Rails,
> but beyond
> Rails there is not much evidence that shows pure Ruby custom web solutions
> to scale. Rails has a lot of features and best practices built in to
> help it scale.
> In a pure Ruby solution you are committing to re-writing all of that
> from scratch.

any examples? i know google is starting to use Ruby.


thanks for your response, it rises valid point that i have to think over


Marc Heiler

10/1/2007 4:30:00 PM

0

Finally a topic I like :)


> rails forces good practices like MVC
I believe this is debatable. What we should not forget
is that, while this uniform maintenance is a good
thing in general, rails also forces you into its world of
thinking.


> The truth is, the language used is only one small part of many
> things they should be carefully considering. [...]
> The language really shouldn't matter all that much.

I will take another approach and claim that the language
used is and will be the biggest most influencing factor.
It is exactly the reason why PHP became popular today -
it beat Perl cgi scripts. It was easier to learn than perl.
It had a good online docu. It concentrated on the web +
database aspects.
Every language has different pros and cons, and there may be
some cases where php really has more advantages than ruby.
But in general ruby as a language is simply better than php.
That includes the world wide web, but unfortunately there
are a little problems. Rails for example, forces you to
think in the rails-way, for the good or for the bad.
(By the way, it would be cool to be able to
embed ruby straight into a .php document... right now
I am porting my legacy .php scripts to ruby, it takes
quite long :P )

> also I'm open to any arguments(preferable documented, with showcases,
> and understandable by investor(who never had much expirience with
> computers except for e-mail and www)) that would help convince him that
> ruby is much better then php :)

Easiest way to convince is code examples. Focus on simple tasks that
have some reallife usage value to him (the investor). But of course
the comparison must be fair, so dont make it too complex ;)

It would actually be nice to have a way to compare PURE php (+solutions)
with PURE ruby (+solutions for web-tasks:

* Post data into a "web formular" in both languages
* retrieve data from a mysql database
* run automated "comparisons" and other data manipulations
from a "web formular" (i.e. something for your investor
that makes working with it easy)


Personally, I am a bit unhappy that PHP is compared to Rails so
often ... PHP should be compared to Ruby, and then if we can,
Ruby should improve on the area where PHP has a slight edge.

To me, speed was NEVER a reason, and to be honest, I think
some people really overrate the speed issue at first hand.
At least it should be untied from OTHER reasons, such as
the online docu part for example, where I think PHP still
has a lead over ruby in that aspect. ;-)
--
Posted via http://www.ruby-....

Marcin Raczkowski

10/1/2007 4:31:00 PM

0

John Joyce wrote:
> I wouldn't sweat it much.
> Show them good sites built with these things. Explain the reasons you
> use what you use.
> If they hire a consultant who only recommends one technology, then he's
> a shill.
> He could just as easily be an ASP shill or a Java shill or anything else.
> Ruby and Rails are still small compared to PHP, but booming and not
> shrinking.
>
> You might want to show a bit more of the ongoing history of insecurity
> that is a lot more rampant with PHP sites, and even recommend a little
> security through obscurity. (that's what kept VAX systems going until HP
> end-of-lifed the OS)
>
> But in the end, if you don't get it, chances are they'll go with a cheap
> and mediocre PHP shop. It's a lot like the cheap and mediocre
> Microsoft-based shops. There are lots of them, but there are lots of bad
> ones. Good PHP shops are probably more expensive (and busier) than you.

One of main reasons why my (small and new) company is considered is
becouse productivity using rails is so high that even if i want much
more money per hour of work then php professional i finish same thing
properly secured with rails before php developer finishes collecting his
tools and code snippets

>
> The truth is, the language used is only one small part of many things
> they should be carefully considering. Server (hardware/software) / web
> hosting can be as/more important. The language really shouldn't matter
> all that much. Google, Yahoo, etc... don't use strictly one language or
> framework in house! A decent programmer / team of programmers should be
> able to select the technology they feel will work best for them AND the
> project together. In some cases Ruby might be the wrong choice.
>

I feel ruby especially thanks to JRuby (possibility to use java
libraries), ruby:inline(possiblity to use c/c++) and IronRuby(same for
c#) might be best choice to tie all together, and i can use rails to
make it all work in record time

> Everybody and their dog touts themselves as a nationwide high-traffic
> portal site to be, but if that were true or even likely, they wouldn't
> need a consultant, they'd have a CTO of some kind who would have already
> decided these issues. Sounds more like your selling lawn care services
> to a guy from the desert who has only heard of grass and is planning to
> build a golf course.

well, mayby i described size wrongly, first of my country is much much
smaller then US :], money are diffirent, and stage of IT also.

CTO's usually depend on consultants anyway, but this one agrees that
ruby is good choice and need a little push, so I'm asking you all to
provide me with arguments i can use in php vs. ruby battle ;)

I know pros and cons, and I personally prefer ruby (i have solid
background in php, never liked it, had horrible 4 months while i tried
to maintain code written by php "programmers", which was full of sql
injection holes) so I "know" i want to write in ruby / ruby on rails,
and think it's right decision to use this technology.

Marcin Raczkowski

10/1/2007 4:31:00 PM

0

mortee wrote:
> I don't take responsibility for the quality of articles linked here -
> but here's a blog post gathering links arguing right what you seem to be
> looking for. Maybe it's worth checking out.
>
> http://rubythis.blogspot.com/2006/12/justify-your-choice-of-ruby-on-...
>
> mortee
>
>
>
thanks that's exactly what i was looking for.

Marcin Raczkowski

10/1/2007 4:44:00 PM

0

> Easiest way to convince is code examples. Focus on simple tasks that
> have some reallife usage value to him (the investor). But of course
> the comparison must be fair, so dont make it too complex ;)
>
> It would actually be nice to have a way to compare PURE php (+solutions)
> with PURE ruby (+solutions for web-tasks:
>
> * Post data into a "web formular" in both languages
> * retrieve data from a mysql database
> * run automated "comparisons" and other data manipulations
> from a "web formular" (i.e. something for your investor
> that makes working with it easy)
since i have background in php i can provide investor with code samples,
but I know that ruby is better for me, problem is to convince investor
that know nothing about programming

> Personally, I am a bit unhappy that PHP is compared to Rails so
> often ... PHP should be compared to Ruby, and then if we can,
> Ruby should improve on the area where PHP has a slight edge.
that's why I'm asking about advantages of ruby (read my post carefully)
and in second order rails - if I'm talking about rails i should compare
it to cakePHP or Smarty or something like that

>
> To me, speed was NEVER a reason, and to be honest, I think
> some people really overrate the speed issue at first hand.
> At least it should be untied from OTHER reasons, such as
> the online docu part for example, where I think PHP still
> has a lead over ruby in that aspect. ;-)

Problem with online docu is that there's TONS of shity, ugly,
exploitable code online for php and noone cares - i even saw statistics
saying that 80% of php code have serious sql-injection vulnerabilities.


as for speed - it doesn't matter if something is 2-3 times slower then
same thing in J2EE, it doesn't even matter if it's 10 times slower, but
if one request to rails takes 5 seconds on modern server it DOES matter ;)