Is Ruby is better than PHP ...

U

Useko Netsumi

or perhaps Java for developing web application?

I've develop a few applications using PHP/MySQL/Apache and its growing in
size. After reading the Ruby tutorial, and do a simple script, I kind of
like this ease of use and a much cleaner language.

But I have reservation about its viability as a dominant web programming
language/tools. As with PHP, everywhere you look its PHP, perhaps it has
extensive bell and whistles for web programmers to write cool and
sophisticate commercials grade web application. How about its security? Is
it better/worse than PHP? Is Ruby thread-safe?

So, what's the drawback of leaving PHP and embrace Ruby as web programming
tools?

Thanks
 
S

Savut

Ruby and PHP are two differents thing. Ruby is used for command line
program supporting user input and run just as batch file or linux shell
script do. PHP run embedded on a webpage and it main purpose is for website
development.

Savut
 
D

Dave Thomas

Ruby and PHP are two differents thing. Ruby is used for command line
program supporting user input and run just as batch file or linux
shell script do. PHP run embedded on a webpage and it main purpose is
for website development.

Damn! I guess I'll have to delete my 40,000 line Ruby web application
then... :)


Cheers

Dave
 
H

Hal Fulton

Dave said:
Damn! I guess I'll have to delete my 40,000 line Ruby web application
then... :)

Don't worry, I'm sure you can rewrite it in 90,000 lines of PHP.

Hal
 
R

Ryan Pavlik

True, but not completely true. Things like mod_ruby and eRuby let
one embed Ruby into HTML, and there is a wealth of different web
application frameworks sitting over on RubyForge for a person to
chose from.

I personally use Ruby for almost all of my dynamic web page / web
application development. It works fantastically well.

Quite. I highly dislike doing web stuff that leaves the functionality
tied to the web... that means either in the CGI or some embedded code.
PHP isn't too easy to make a backend with.
 
U

Useko Netsumi

It is very unfortunate that this nice young language does not consider the
web development in mind. I even think that if and only if Ruby creator ever
think this thru by including web design in mind, Ruby can easily gain its
popularity against PHP and Java because of its ease of use features, its
consistency, its OO paradigm, and many.

Is there any work being done to cater specifically for web development?
Thanks
 
F

Florian Gross

Useko said:
So, what's the drawback of leaving PHP and embrace Ruby as web
programming tools?

First of all: It's very hard to compare languages to each other. You
generally don't earn much in these debates because standpoints and
premises heavily differ from person to person and when this sort of
question arises with Ruby and Python or something similar, I generally
just suggest trying out both. And this might still be the best idea in
this case.

However I'll write a more aggressive reply this time. This will be very
subjective and is by no means meant as an insult to any guys out there
using PHP.

I think that PHP has major flaws in its underlying design. It has lots
of inconsistency in its standard library, its naming conventions are a
major mess, its integrated standard libraries don't use OOP much, there
are broken concepts like super globals, it has a history of sacrificing
security just to make the language appear simpler (Introducing things
like auto importing of parameters are this sort of mess -- the PHP world
still has to recover from the damage caused by that model.) I also think
that that the approach of putting everything into the interpreter is
flawed -- standard library (and the "Batteries included" way of
thinking) *are* good concepts, but there's no argument for putting this
into the interpreter IMHO. (Yes, it's still somewhat modular, but that
doesn't help much.)

PHP seems to be taking anther, better route with PHP5 which means that
the things I just complained about might well be hopelessly outdated in
a few years.

There's one good argument for using PHP however and that is industry
acceptance -- PHP has lots of frameworks readily available. Ruby doesn't
have those to the same degree -- it's getting closer, but if this is
what is most important to you, you might get good results with Python.

It's everybody's good right to disagree with this opinion. I don't want
to try to convince the PHP community that they should stop using the
language -- this is just how I feel towards PHP.

I hope I could help and didn't offend anyone too much. Remember, this is
just my opinion and that it's by no means neutral and undistorted.

Kind regards,
Florian Gross
 
P

Phil Tomson

Damn! I guess I'll have to delete my 40,000 line Ruby web application
then... :)

And I'll have to get rid of all that Ruby/FLTK code I've been writing to
develop a GUI app... Bummer.

Phil
 
P

Phil Tomson

It is very unfortunate that this nice young language does not consider the
web development in mind.

Well, you know how it is with these young languages. They're just too
carefree to consider the serious stuff. They just want to have fun ;-)

Seriously, there is a lot of web development work being done in ruby and
some very nice frameworks have been and are being developed.
I even think that if and only if Ruby creator ever
think this thru by including web design in mind, Ruby can easily gain its
popularity against PHP and Java because of its ease of use features, its
consistency, its OO paradigm, and many.

Is there any work being done to cater specifically for web development?

I'm not an expert in Web development by any stretch, but here are a few
pointers:

cgikit http://www.spice-of-life.net/cgikit/index_en.html
CGIKit is a web application framework like Apple Computer's WebObjects.
This framework services Model-View-Controller architecture programming by
component based on a HTML file, a definition file and a Ruby source.

arrow http://rubycrafters.com/projects/Arrow/
Arrow is a framework for building web applications using Apache and
mod_ruby.

borges http://borges.rubyforge.org
Borges is a modal web application framework that keeps track of
state, so you can go back and undo or redo operations.

rails http://www.rubyonrails.org/show/HomePage
Rails is a soon-to-be-released web-application framework for Ruby. It’s
built upon well-understood patterns which should make the seasoned web
developer feel right at home and the new comer welcome.
Full-stack framework: Model, View, and Control
Rails is a composition of three sub-projects that make up the Model, View,
and Control tiers. This means that most web applications shouldn’t need
to assemble anything else to get off the ground.

....there are more like Amrita, but this should be enough to get you
started.

Phil
 
P

Paul Vudmaska

Useko said:
or perhaps Java for developing web application?

I've develop a few applications using PHP/MySQL/Apache and its growing in
size. After reading the Ruby tutorial, and do a simple script, I kind of
like this ease of use and a much cleaner language.

But I have reservation about its viability as a dominant web programming
language/tools. As with PHP, everywhere you look its PHP, perhaps it has
extensive bell and whistles for web programmers to write cool and
sophisticate commercials grade web application. How about its security? Is
it better/worse than PHP? Is Ruby thread-safe?

So, what's the drawback of leaving PHP and embrace Ruby as web programming
tools?

Thanks
What you get with PHP is maturity and speed and a dirty namespace.

Ruby is more elegant and extensible -beautifully object oriented with a
great class structure. You can extend/change built in classes.

With ruby i spend much less time in the docs and more coding.

Dont get me wrong PHPs docs are great and organized- the implementation
is not.
 
L

Lothar Scholz

Hello Useko,

Wednesday, April 21, 2004, 5:59:05 PM, you wrote:

UN> or perhaps Java for developing web application?

UN> I've develop a few applications using PHP/MySQL/Apache and its growing in
UN> size. After reading the Ruby tutorial, and do a simple script, I kind of
UN> like this ease of use and a much cleaner language.

UN> But I have reservation about its viability as a dominant web programming
UN> language/tools. As with PHP, everywhere you look its PHP, perhaps it has
UN> extensive bell and whistles for web programmers to write cool and
UN> sophisticate commercials grade web application.

I also see Lisp (like Yahoo) and Smalltalk based web applications.
There are a lot of way to do things.

UN> How about its security? Is
UN> it better/worse than PHP? Is Ruby thread-safe?

Its worse if you have to use a shared hosting environment. Its not
possible to protect different virtual hosts when using mod_ruby. Of
course you can setup an FCGI ruby server for each virtual host, but
this can raise your memory consumption a lot.

UN> So, what's the drawback of leaving PHP and embrace Ruby as web programming
UN> tools?

If you must host 100 users on a 2,0 GHz Pentium with 1 GB RAM, you
don't have real a choice: you must use PHP.

But if you do more complicated thinks in larger applications there is
no drawback in leaving PHP and moving to a new language, whatever you
choose (maybe FORTH or Assembler wouldn't be really good but maybe
still better then PHP :)

Virtual Servers get more popular every day, so you have the freedom to
choose what you want.
 
L

Lothar Scholz

Hello Kirk,

Wednesday, April 21, 2004, 10:13:11 PM, you wrote:

KH> The devil is in the details, but I am pretty confident that I could
KH> support 100 sites on a 2.0 Ghz Intel server with 1GB of ram, if they were
KH> all using Iowa to drive their dynamic content.

Thanks, my experience with amrita was going into the other direction.
Anyone ever tried the ClearSilver template system
http://www.clearsilver.net/ ?
 
Z

Zachary P. Landau

--SnV5plBeK2Ge1I9g
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable


I think one thing people like about PHP is it comes with a lot of
built-in functions for dealing with Web-related problems. It might be
an interesting project for someone to make a list of common PHP
functions used in web developments, with their Ruby equivalent
(including what library it comes from).=20

For example, just taking a quick look at the PHP docs I see 'URL
Functions' with base64_decode and base64_encode. So the table might have

PHP Ruby
---- ----
base64_decode require 'base64'
Base64::decode64

base64_encode require 'base64'
Base64::encode64

Maybe it could even follow a similar organizational structure as the PHP
docs, so someone who wants to move from PHP to Ruby would feel right at
home.

--
Zachary P. Landau <[email protected]>
GPG: gpg --recv-key 0x24E5AD99 | http://kapheine.hypa.net/kapheine.asc

--SnV5plBeK2Ge1I9g
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAhugKCwWyMCTlrZkRAnosAJwMArxc72SBSOJlehzl0l2hVIUFvwCghuXH
24n09HkgDkyHz1eMIoP4i24=
=x1oq
-----END PGP SIGNATURE-----

--SnV5plBeK2Ge1I9g--
 
Z

zatoichi

Christian said:
Well I use PHP nearly only on command line as a neat Perl replacement and just saw that ruby is of course also available as embedded Apache
scripting language (mod_ruby) so you guys should better focus to the language itself instead on their original purpose :)
(but IMHO ruby looks ugly => use php *g*)

-christian-
PHP on the command line as a "neat" Perl replacement. Ack!
 
L

Lothar Scholz

Hello Zachary,

Wednesday, April 21, 2004, 11:35:09 PM, you wrote:


ZPL> PHP Ruby
ZPL> ---- ----
ZPL> base64_decode require 'base64'
ZPL> Base64::decode64

ZPL> base64_encode require 'base64'
ZPL> Base64::encode64

Why not

string.pack("m"); string.unpack("m") ??

If find this much easier
 
C

Chris Dutton

Zachary said:
I think one thing people like about PHP is it comes with a lot of
built-in functions for dealing with Web-related problems. It might be
an interesting project for someone to make a list of common PHP
functions used in web developments, with their Ruby equivalent
(including what library it comes from).

Or even going a step farther, create a module that's nothing but
wrappers around those methods/classes.

require "php-transition"

plain = base64_decode(source)
# actually is:
# plain = Base64::decode64(source)

Though I have a feeling that having both PHP and Ruby targetting Parrot
would make this significantly easier, as long as the PHP functions are
implemented in a modular way.
 
Z

Zachary P. Landau

--Sw7tCqrGA+HQ0/zt
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
ZPL> PHP Ruby
ZPL> ---- ----
ZPL> base64_decode require 'base64'
ZPL> Base64::decode64
=20
ZPL> base64_encode require 'base64'
ZPL> Base64::encode64
=20
Why not
=20
string.pack("m"); string.unpack("m") ??
=20
If find this much easier

That's all Base64::encode/decode64 does, but when glancing over code,
Base64::encode64(str) tells me more than str.pack("m"). I was never
very good with remembering pack notation, and I'd like to think other
people are in the same boat as me. =20

--
Zachary P. Landau <[email protected]>
GPG: gpg --recv-key 0x24E5AD99 | http://kapheine.hypa.net/kapheine.asc

--Sw7tCqrGA+HQ0/zt
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAhu6zCwWyMCTlrZkRAu68AJwJDwY0hLwhlvcS+5cvytkYp/3ZqACdEKJR
/EnXlaYo5ugbVWzWaQAEWEk=
=9DSc
-----END PGP SIGNATURE-----

--Sw7tCqrGA+HQ0/zt--
 
Z

Zachary P. Landau

--Uu2n37VG4rOBDVuR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

=20
Or even going a step farther, create a module that's nothing but=20
wrappers around those methods/classes.
=20
require "php-transition"
=20
plain =3D base64_decode(source)
# actually is:
# plain =3D Base64::decode64(source)
=20
Though I have a feeling that having both PHP and Ruby targetting Parrot= =20
would make this significantly easier, as long as the PHP functions are=20
implemented in a modular way.

As helpful as that may be to people, one of PHPs major problems (as
someone mentioned) is namespaces. I would hate to bring that over to
Ruby. It would be better to teach people to do it properly.

--
Zachary P. Landau <[email protected]>
GPG: gpg --recv-key 0x24E5AD99 | http://kapheine.hypa.net/kapheine.asc

--Uu2n37VG4rOBDVuR
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAhvOoCwWyMCTlrZkRAnJ6AJ9OWDCvlssTR9h4QByWXqhQ3TCf8QCfTkrs
7AFC/hnDaTpTsSm0wohxIls=
=xHhD
-----END PGP SIGNATURE-----

--Uu2n37VG4rOBDVuR--
 
L

Lothar Scholz

Hello Zachary,

Thursday, April 22, 2004, 12:24:46 AM, you wrote:


ZPL> As helpful as that may be to people, one of PHPs major problems (as
ZPL> someone mentioned) is namespaces. I would hate to bring that over to
ZPL> Ruby. It would be better to teach people to do it properly.

This is not the major problem of PHP. The major problem is that you
always start with an empty universe and must reread all data on each
page.

In Ruby you have also a really huge namespace problem comming from the
fact that library developer A adds some feature here and there, for
example some nice string tokenizer called "fast_tokenizer" etc. and
developer B does the same with his version.

So PHP has one namespace problem which is so obvious that people try
to avoid this by using prefixes. It is hard to explain the same
problem to ruby developers.
 

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

No members online now.

Forum statistics

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

Latest Threads

Top