[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Language Popularity - PHP vs Ruby?

Marc Heiler

11/6/2007 3:25:00 PM

Hi,

I decided to make this _rather_ short, because I think noone wants
to read a lot of long stuff. It is still too long though.
But please believe me, I thought some time about the content.

On http://www.la... the author has some nice graphs.
The trend seems to show that PHP is (still) a very popular
language. PHP at the same time however, is a horrible
language compared to ruby. I also do NOT at all believe
that any speed difference was an important factor for
PHP's popularity rise, nor is today. I think PHP benefitted
from a growing web world, and in return helped (foster)
the web world grow as well, together with apache and MySQL.
(I remember the perl-cgi days ... )

Ruby has Rails, but Rails needs more libraries, and Rails has a
very specific world-view (MVC) whereas PHP basically just cares
about getting the c**p outta *SQL and the "thing done", as ugly
as it may be. We could use Ruby instead for web-stuff, but Ruby
as such lacks in this regard here and there, i.e. at times
mod_ruby was just a pain to install, online-docu for ruby is
still not that good (even though a lot has changed the last 2
years... Pickaxe was wonderful but things change so quickly...)
ruby-cgi stinks a bit since it does not report where it
found an error and is rather slow compared to a .php site,
and "killer apps" like a phpBB variant for _ruby_ do not
seem to shape up _without_rails (and even with rails, it
seems a LOT of work..)

Does anyone notice .rhtml files at all on the www?
I see .php pages all the time. (Almost) all the webshops use
them (yuck). Loads of blogs use php. The basic underlying task of
what these scripts do is so simple, but ruby doesnt grow in this
area as php did. Rails alone can not be the solution to compete
with php on that area (assuming we want that) due to the lesser
flexibility (I have experienced that MANY people who learn rails
are just outright confused by ruby...):

- Simplicity sometimes beats conventions.
- Ugliness sometimes beats beauty.

This is NOT an anti-rails post. This is a PRO post to get
ruby fit for the www. Or at least, fitter/better!

Back to www.langpop.com for querying top 3 "jobs wanted"
notes, PHP and SQL is among them (rank 3 / rank 1).
Yuck yuck yuck. But you see it still seems popular and I dare
claim they would be better off using what is *needed* to
complete a job in an elegant fashion - with ruby instead.
At least that is my firm opinion - well written ruby code
is shorter and more elegant than well written php code
of comparable "feature set".

The del.icio.us site was also "analyzed" on http://www.la... -
ruby and python both seem more popular than in the other grows.
That must mean, that people search for both quite a lot.
For example, Ogre3d, Blender project and the small game
engine FiFE all have usable python bindings.
No perl, no lua, no ruby on that.
But ...

PHP also wins on del.icio.us and in fact is only beaten
by _JAVASCRIPT_ !
Does this hint at the importance of the www? :)

My conclusio, even if people heard that too ofte... and I
promise to be silent about it for some months to :D

I think the www should be one of the most important
aspects for ruby!
--
Posted via http://www.ruby-....

25 Answers

bwv549

11/6/2007 8:21:00 PM

0

PHP isn't as consistent or beautiful as ruby, but it hardly matters
when you have online documentation like this:

http://www.php.net/...

We (the ruby community) really should have excellent, up-to-date,
comprehensive online documentation. Considering its online
documentation, it is amazing that ruby is as popular as it is.
Pickaxe I is great but stale now, and I am too cheap to buy the 2nd
edition (like millions of other college/grad students out there). Are
there any projects out there attempting to create good, online
documentation for ruby? Are we waiting for 2.0 before doing this?

>> I think the www should be one of the most important aspects for ruby!

Agreed, who wants to write up a library porting or ruby-izing
everything useful to www in PHP to ruby? Anyone? :)

--john

Ilan Berci

11/6/2007 9:48:00 PM

0

Marc Heiler wrote:
> Hi,
>

> Does anyone notice .rhtml files at all on the www?
>

mod_rewrite

Pickaxe 2, dealing with 1.8, is as relevant today as the day it was
printed.

Rails has everything it needs and the amount of add-ons through gems,
plugins, generators, etc... is amazing.. please give specific examples
of a task you couldn't complete through rails and ask on the rails list
for a suggestion.

Please site an example where you found PHP easier than rails.

@bwv549

The people updating ruby documentation do so on a voluntary basis. The
amount of work that has already went into it is staggering and I am sure
they would welcome more volunteers if you are interested.


ilan


--
Posted via http://www.ruby-....

Alex Young

11/7/2007 10:20:00 AM

0

Ilan Berci wrote:
> Please site an example where you found PHP easier than rails.
mv index.php ~/public_html

Sorry, but it's true. Deployment of PHP is trivial, deployment of Ruby
isn't. That's one big reason why it's as popular as it is.

--
Alex


Vasyl Smirnov

11/7/2007 10:44:00 AM

0

On Nov 7, 12:19 pm, Alex Young <a...@blackkettle.org> wrote:
> Ilan Berci wrote:
> > Please site an example where you found PHP easier than rails.
>
> mv index.php ~/public_html
>
> Sorry, but it's true. Deployment of PHP is trivial, deployment of Ruby
> isn't. That's one big reason why it's as popular as it is.

Same as mv index.rb ~/public_html

leaving only the necessity to do some mod_ruby configuration.

(I'm not talking about Rails, just eruby)


David A. Black

11/7/2007 11:03:00 AM

0

Hi --

On Wed, 7 Nov 2007, Vasyl Smirnov wrote:

> On Nov 7, 12:19 pm, Alex Young <a...@blackkettle.org> wrote:
>> Ilan Berci wrote:
>>> Please site an example where you found PHP easier than rails.
>>
>> mv index.php ~/public_html
>>
>> Sorry, but it's true. Deployment of PHP is trivial, deployment of Ruby
>> isn't. That's one big reason why it's as popular as it is.
>
> Same as mv index.rb ~/public_html
>
> leaving only the necessity to do some mod_ruby configuration.
>
> (I'm not talking about Rails, just eruby)

I'm glad you pointed that out. This thread seems to be slipping into
Ruby/Rails confusion, or perhaps to have been based on that confusion
from the beginning.


David

--
Upcoming training by David A. Black/Ruby Power and Light, LLC:
* Advancing With Rails, Edison, NJ, November 6-9
* Advancing With Rails, Berlin, Germany, November 19-22
* Intro to Rails, London, UK, December 3-6 (by Skills Matter)
See http://www.r... for details!

Alex Young

11/7/2007 11:12:00 AM

0

Vasyl Smirnov wrote:
> On Nov 7, 12:19 pm, Alex Young <a...@blackkettle.org> wrote:
>> Ilan Berci wrote:
>>> Please site an example where you found PHP easier than rails.
>> mv index.php ~/public_html
>>
>> Sorry, but it's true. Deployment of PHP is trivial, deployment of Ruby
>> isn't. That's one big reason why it's as popular as it is.
>
> Same as mv index.rb ~/public_html
>
> leaving only the necessity to do some mod_ruby configuration.
Am I wrong in thinking that mod_ruby runs all scripts in the same
interpreter, so they all share a namespace?

--
Alex

John Joyce

11/7/2007 12:03:00 PM

0


On Nov 7, 2007, at 4:19 AM, Alex Young wrote:

> Ilan Berci wrote:
>> Please site an example where you found PHP easier than rails.
> mv index.php ~/public_html
>
> Sorry, but it's true. Deployment of PHP is trivial, deployment of
> Ruby isn't. That's one big reason why it's as popular as it is.
>
>
If by deployment of php, you mean using php in web development is
trivial, yes it's true.
If by deployment of php, you mean installing and configuring a php
interpreter is trivial, it is not true at all. It's quite a task.
All Apache modules can be a pain.

Vasyl Smirnov

11/7/2007 3:14:00 PM

0

On Nov 7, 1:11 pm, Alex Young <a...@blackkettle.org> wrote:
> Am I wrong in thinking that mod_ruby runs all scripts in the same
> interpreter, so they all share a namespace?

The following:

page-a.rb

#!/usr/local/bin/eruby
<%
class Foo
def bar
puts "Page A: Foo#bar<br>"
end
end
def baz
puts "Page A: baz<br>"
end
Foo.new.bar
baz
%>

page-b.rb:

#!/usr/local/bin/eruby
<%
class Foo
def bar
puts "Page B: Foo#bar<br>"
end
end
def baz
puts "Page B: baz<br>"
end
Foo.new.bar
baz
%>

works just fine.

I'm pretty new to both ruby and eruby, and only about to dive deeply
into the latter.
And yes, I've heard about some issues concerning the shared
interpreter, though I've yet to run into them.

The only problem so far was the need to turn on "RubyRequire auto-
reload".


Phrogz

11/7/2007 4:06:00 PM

0

On Nov 7, 8:14 am, Vasyl Smirnov <vasyl.smir...@gmail.com> wrote:
> On Nov 7, 1:11 pm, Alex Young <a...@blackkettle.org> wrote:
>
> > Am I wrong in thinking that mod_ruby runs all scripts in the same
> > interpreter, so they all share a namespace?
>
> The following:
>
> page-a.rb
>
> #!/usr/local/bin/eruby
> <%
> class Foo
> def bar
> puts "Page A: Foo#bar<br>"
> end
> end
> def baz
> puts "Page A: baz<br>"
> end
> Foo.new.bar
> baz
> %>
>
> page-b.rb:
>
> #!/usr/local/bin/eruby
> <%
> class Foo
> def bar
> puts "Page B: Foo#bar<br>"
> end
> end
> def baz
> puts "Page B: baz<br>"
> end
> Foo.new.bar
> baz
> %>
>
> works just fine.

Yes, it would, but that could be because each file runs over the other
one.
For example:

C:\>type t1.rb
class Foo
def bar
puts "Page A: Foo#bar<br>"
end
end
def baz
puts "Page A: baz<br>"
end
Foo.new.bar
baz

C:\>type t2.rb
class Foo
def bar
puts "Page B: Foo#bar<br>"
end
end
def baz
puts "Page B: baz<br>"
end
Foo.new.bar
baz

C:\>irb
irb(main):001:0> load 't1.rb'
Page A: Foo#bar<br>
Page A: baz<br>
=> true

irb(main):002:0> load 't2.rb'
Page B: Foo#bar<br>
Page B: baz<br>
=> true

irb(main):003:0> load 't1.rb'
Page A: Foo#bar<br>
Page A: baz<br>
=> true


Obviously that's all in the same namespace/interpreter, but you don't
see a problem. Instead, try something like this:

C:\>type t1.rb
p @foo ||= 'page 1'

C:\>type t2.rb
p @foo ||= 'page 2'

C:\>irb
irb(main):001:0> load 't1.rb'
"page 1"
=> true

irb(main):002:0> load 't2.rb'
"page 1"
=> true

Vasyl Smirnov

11/7/2007 4:38:00 PM

0

On Nov 7, 6:10 pm, Phrogz <phr...@mac.com> wrote:
> [cut]
>
> Obviously that's all in the same namespace/interpreter, but you don't
> see a problem. Instead, try something like this:
>
> [cut]

OK, here we go:

t1.rb:

#!/usr/local/bin/eruby
<%
p @foo ||= 'page 1'
%>

t2.rb:

#!/usr/local/bin/eruby
<%
p @foo ||= 'page 2'
%>

Result - works like a charm: t1 gives "page 1", t2 gives "page 2"
(in the browser window, of course).
No matter how many times and in what sequence I reload the pages.