Jump to content

Ruby vs PHP

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
14 replies to this topic

#1
Dalbiez

Dalbiez

    Newbie

  • Members
  • Pip
  • 2 posts
Hello

I'm new here so I though maybe it's nice to introduce myself. I'm Dalbiez, I'm coming from Holland and I'm 14 years old. Since last weeks I'm having a problem, I can't choose the right language. I want to create web applications. PHP is the most populair language for the web but Ruby has a nice syntax.

Ruby
  • Nice syntax.
  • Friendly community.
  • Nice web frameworks like Ramaze.

Of course Ruby has some cons:

Ruby
  • Expensive hosting for a 14 year old teenager.
  • Less populair than PHP.

Then PHP comes:

PHP

  • Really popular!
  • Lot of code is available.
  • A huge community
  • Has nice web frame works.
  • Cheap hosting.
  • I already know some PHP.

And the cons:

PHP

  • The syntax is sloppy.

At the moment I'm more fan of Ruby, I really like it. Everytime I write PHP code I think "I need to write this in Ruby". But I want to be a web-developer when I'm older and PHP is more populair so when I'm looking to my future it's better to learn PHP.

Thanks,
Dalbiez and sorry for my bad English!

#2
Guest_Jordan_*

Guest_Jordan_*
  • Guests
I haven't used Ruby enough for a fair comparison but I know I dislike it compared against PHP. I also think the syntax is better in PHP than in Ruby. One of the big things that turned me off from Ruby is the lack of line ending syntax. To me, it looks more like Visual Basic and seems too simplistic.

#3
chili5

chili5

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 7,247 posts
You think Ruby has a nice syntax?

Like Jordan I haven't used Ruby enough to compare them. The one thing that turns me off from PHP is a lot of very redundant functions. I wouldn't say popularity is a con though.

#4
TkTech

TkTech

    The Crazy One

  • Moderators
  • 1,396 posts
One of the major reasons people turn down Ruby is the syntax. If you take the time to get used too it, its just like any other of the dozens of languages you might have dabbled in. One thing I do like is Ruby On Rails, which is a WIN framework using the MVC architectural pattern. Its RAD for the web.

#5
mikelbring

mikelbring

    Programmer

  • Members
  • PipPipPipPip
  • 118 posts
Yeah if your gonna use ruby, use ruby on rails framework. Its quickly becoming super popular, but im a php developer my self.

Realize the Web Web services and design.


#6
Dalbiez

Dalbiez

    Newbie

  • Members
  • Pip
  • 2 posts
Well, I don't like {, }, ; and such. But when I'm looking to my furute maybe PHP is better, right?

#7
Guest_Jordan_*

Guest_Jordan_*
  • Guests
I believe many people prefer PHP over Ruby but I don't know if there is actually any evidence that one is better than the other.

Edited by Jordan, 20 June 2009 - 04:50 AM.


#8
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Measuring "better" is highly subjective. My boss likes Delphi, I prefer C++. Our definitions of "better" are the reason why we gravitate to different languages. I suspect the same is true of Ruby vs PHP.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#9
Momotaro

Momotaro

    Newbie

  • Members
  • Pip
  • 7 posts
Choose whichever one you're more comfortable with. It'll be much easier for you that way.

#10
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
I think Ruby's syntax is ugly.

#11
Aereshaa

Aereshaa

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 790 posts
Actually, ruby's line-endings are exactly the same as in shell scripts, or Perl.
x = 1 #complete

x = 1 + #incomplete, go to next line

1 #complete

x = 1;y = 2 #two complete statements on one line
Essentially, it reads tokens until it reaches a semicolon or end-of-line, and then checks whether it has a complete statement. You can of course put semicolons at the end of every statement if you want to, it's just not necessary. Is there anything else you object to, Jordan?
EDIT: For those who don't know ruby, I've attached a simple program I wrote in it.

Attached Files


Watches: Nanoha, Haruhi, AzuDai. Listens to: E-Type, Dj Melodie, Nightcore.
"When people are wrong they need to be corrected. And then when they can't accept it, an argument ensues." - MeTh0Dz

#12
Guest_Jordan_*

Guest_Jordan_*
  • Guests

Aereshaa said:

Actually, ruby's line-endings are exactly the same as in shell scripts, or Perl.
x = 1 #complete
x = 1 + #incomplete, go to next line
1 #complete
x = 1;y = 2 #two complete statements on one line
Essentially, it reads tokens until it reaches a semicolon or end-of-line, and then checks whether it has a complete statement. You can of course put semicolons at the end of every statement if you want to, it's just not necessary. Is there anything else you object to, Jordan?
EDIT: For those who don't know ruby, I've attached a simple program I wrote in it.

This is what I object to. Lazy line ending syntax just like JavaScript. Now you'll find 20% of people who do add it and 80% of people who do not add it. Enforcing a syntax standard should be part of the interpreter/compiler, not left up to users. This language reminds me of Visual Basic.

Edited by Jordan, 24 June 2009 - 01:51 PM.