Language Popularity - PHP vs Ruby?

M

Marc Heiler

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.langpop.com/ 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.langpop.com/ -
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!
 
B

bwv549

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

http://www.php.net/manual/en/

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?

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

--john
 
I

Ilan Berci

Marc said:
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
 
A

Alex Young

Ilan said:
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.
 
V

Vasyl Smirnov

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)
 
D

David A. Black

Hi --

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.rubypal.com for details!
 
A

Alex Young

Vasyl said:
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?
 
J

John Joyce

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.
 
V

Vasyl Smirnov

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".
 
P

Phrogz

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
 
V

Vasyl Smirnov

[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.
 
T

tho_mica_l

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.

Repeating this test with a global variable $foo might be more
revealing though, as it is unclear in which context @foo is evaluated.

or

p defined?(Foo)
class Foo
end
 
V

Vasyl Smirnov

Repeating this test with a global variable $foo might be more
revealing though, as it is unclear in which context @foo is evaluated.

Yep, you're right...
 
M

Michal Suchanek

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.

However, PHP is already installed on many web hosting servers, The
number of admins capable of installing PHP (or having a test install
somewhere already) you see by just looking around in your IT
department is usually non-zero, not the same for Ruby.

There are also technical reasons for this. The mod_php has (after some
years of development) "sound security" (no more security holes than
the underlying POSIX). PHP has also a sound interpreter that you can
reset to the initial state which allows isolation of different
programs running in the apache workers, especially programs of
different users.

I guess once we get something like mod_ruby with similar level of
functionality as mod_php we could see it installed on some freewebs
(or cheapwebs at least) and people picking Ruby more often. Currently
you need dedicated hardware or equivelent to run a Ruby site which is
quite forbidding. Fixing this should be possible after 1.9.

Thanks

Michal
 
V

Vasyl Smirnov

Repeating this test with a global variable $foo might be more
revealing though, as it is unclear in which context @foo is evaluated.

or

p defined?(Foo)
class Foo
end

again, the latter form somehow does work :)

defined.rb:

#!/usr/local/bin/eruby
<%
p defined?(Foo)
class Foo
end
p defined?(Foo)
%>

outputs << nil "constant" >> to the browser.

So maybe just the global vars are shared?
 
M

Michael Jackson

...PHP at the same time however, is a horrible
language compared to ruby...PHP basically just cares
about getting the c**p outta *SQL and the "thing done", as ugly
as it may be...

The Ruby community really needs to calm down about this language
superiority thing. I'm new to Ruby, and I've been hanging out on this
list for the past month or two. I'm not sure if you guys realize how
many of your emails are anti-some-language or comparing Ruby's
popularity to the others. It's really a turn-off. It's like an
insecure woman looking in the mirror asking you if she looks OK. "Of
course!," you say. "You're beautiful!" And then she asks you again
and again...
I see .php pages all the time. (Almost) all the webshops use
them (yuck). Loads of blogs use php...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...PHP also wins on del.icio.us and in fact is only
beaten
by _JAVASCRIPT_ !

PHP code can also be beautiful if written correctly. Given the
present circumstances, it sounds to me like you'd better go learn
PHP. ; )

Michael
 
P

Peter Szinek

Hello,
The Ruby community really needs to calm down about this language
superiority thing. I'm new to Ruby, and I've been hanging out on this
list for the past month or two. I'm not sure if you guys realize how
many of your emails are anti-some-language or comparing Ruby's
popularity to the others. It's really a turn-off. It's like an insecure
woman looking in the mirror asking you if she looks OK. "Of course!,"
you say. "You're beautiful!" And then she asks you again and again...

Though I am trying to avoid (language) flame wars or anything related to
them, I really have to disagree here. The above paragraph holds for the
right-wing activists of the Rails party, but definitely not for Ruby in
general. Most of the people here are coming from Java, C#, PHP and other
languages, not necessarily leaving those behind. I have seen some
serious Java (as well as other language, or language-agnostic) questions
answered here without bashing or pointing out how X sucks.

I tried to ignite a Java vs. Ruby flame war once (in the favor of Ruby
of course), and I was kicked in the *ss very quickly by quite a few guys
here (not necessarily Java fanatics, just normal coders pointing out
that language flame wars are pointless and Ruby doesn't need to prove
it's superiority over anything), then the thread died off.

Of course that doesn't mean that emails like the one starting this
thread do not come up from time to time, or that someone doesn't start
some spontaneous bashing etc. However, in general, I find the Ruby
mailing list the friendliest one if it comes to superiority proving (and
a lot of other things, too). Individuals will always have different
levels of 'insecure-womanhood' as you put it and a lot of other things
as well, but in general, the Ruby community as a whole is definitely not
like that.
PHP code can also be beautiful if written correctly.

That's true for assembler code, too (though it definitely requires
different glasses than those of an average Java/C++/PHP/Ruby programmer)
and possibly for just any language out there. Proponents of Ruby are
arguing that PHP is not OOP (a frequent reason for Perl guys to come
over, too) which makes some advanced techniques quite hard to implement
(like Ruby's metaprogramming capabilities etc.) and ... well I am
starting to get into details so I am better switching off. </off>

Of course as we all know, all these languages we are talking about here
are Turing complete, which basically means you can accomplish the same
stuff in any of them. However, I guess you won't argue that it's a
different feeling to code in asm, C, Perl, PHP, Java or Ruby for that
matter. Rubyists are the most productive and feel the best when
programming in Ruby. This is a very subjective thing, therefore it
doesn't make too much sense to attack each other or argue over it (it's
like bashing Chivas Regal on the Jack Daniels mailing list). If in your
case the sweet spot is PHP, all the power to you. After programming in
~10 languages, I am staying with Ruby for now, until something better
comes along.
Given the present
circumstances, it sounds to me like you'd better go learn PHP. ; )

Be sure that most of the people here have tried PHP or something similar
before (or even after) their encounter with Ruby, some are even
mastering it and maybe even using it further. This is not an either/or
situation: you can learn, use, heck, even like more languages at once.
You can stay with PHP forever, and put yet another language in your
toolbox.


Peace,
Peter
___
http://www.rubyrailways.com
http://scrubyt.org
 
J

James Britt

Peter said:
Hello,


Though I am trying to avoid (language) flame wars or anything related to
them, I really have to disagree here. The above paragraph holds for the
right-wing activists of the Rails party, but definitely not for Ruby in
general. Most of the people here are coming from Java, C#, PHP and other
languages, not necessarily leaving those behind. I have seen some
serious Java (as well as other language, or language-agnostic) questions
answered here without bashing or pointing out how X sucks.


This list has a permathread of "python v. ruby", and for the most part
people are simply told to try both and see what makes you most happy.

That's not to say there aren't some people who prefer to attempt nasty
smack-downs, but they are in the minority.

You can't just count the number of ranting pro-ruby posts; you also have
to see if they aren't all coming from the same 2 or 3 people.


MINASWAN


--
James Britt

http://web2.0validator.com - We're the Dot in Web 2.0
http://www.rubyaz.org - Hacking in the Desert
http://www.jamesbritt.com - Playing with Better Toys
 
M

Michael Jackson

Peter said:
This list has a permathread of "python v. ruby", and for the most
part people are simply told to try both and see what makes you
most happy.

That's not to say there aren't some people who prefer to attempt
nasty smack-downs, but they are in the minority.

You can't just count the number of ranting pro-ruby posts; you also
have to see if they aren't all coming from the same 2 or 3 people.

You guys are absolutely right. My apologies for grouping everyone on
the list into one group. That was stupid of me.

Michael
 
T

tho_mica_l

The Ruby community really needs to calm down about this language
superiority thing.

Well, one often cited credo around here is that you should learn a new
language every x month, and I think that ruby profits a lot from this
attitude. Innovation often means wandering through unknown (as in
"where no man has been before" :) or "foreign" territory and coming
back with new ideas.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top