r/programming • • Feb 24 '13

Ruby 2.0.0

http://www.ruby-lang.org/en/news/2013/02/24/ruby-2-0-0-p0-is-released/
600 Upvotes

193 comments sorted by

View all comments

Show parent comments

3

u/hak8or Feb 24 '13

By more complex, are you referring to more dynamic pages? Why would I use Ruby over PHP/HTML/CSS/JS? Does Ruby essentially combine what I listed before into one language?

-5

u/[deleted] Feb 24 '13

Ruby, I should mention, is a real programming language, whereas PHP can only be used for dynamic pages and is usually just embedded into HTML. You can do this with Ruby too of course. You can create native programs (weasel word, but compiles to bytecode and similar things probably don't mean much to you).

In web programming, Ruby is often used as the backend for dynamic web sites in lieu of say, ASP.NET, Java EE or PHP (or Python, in Reddit's case).

Why? because Ruby is a really, really nice language! I haven't been as productive with other languages as I have with Ruby. And that goes for a lot of other people, too.

If you want to get started with programming, Ruby is probably your best bet. I'd highly recommend the TryRuby tutorial by Code School. Codecademy also offers 'learning by doing' exercises, though you have to sign up (it's completely free though, unlike Code School's more advanced exercises). Otherwise, pick up a good book on it. Your local library should have one, Ruby is one of the top ten programming languages for a reason (hint: it's awesome!).

10

u/TikiTDO Feb 24 '13 edited Feb 24 '13

Now let's note get carried away here. PHP has a perfectly capable standalone interpreter which allows you to do anything you would want in a scripting language. I've written some threading server apps in PHP for the hell of it, and my only complaints there were syntax related. There are even tools to compile PHP to bytecode.

Ruby is great if you want a language that's pretty simple to pick up, without too many caveats until you get really deep into the guts of the environment. It's not the most efficient language out there, but with support for C plugins even that can be addressed for most situations. I wouldn't use it for very performance critical operations, but it's a good choice for general coding, and particularly good for prototyping.

0

u/Moocat87 Feb 24 '13

I think the best distinction to draw is that Ruby is an object oriented programming language while PHP is a scripting language. Yes, you can do whatever you want in either, but each has its very distinct strengths. Ruby is closer in purpose to C/C++, upon which operating systems are built, than PHP, which lives in scriptland with shell scripting languages. You wouldn't usually pick PHP to write a back-end. Ruby, definitely. And with Rails, it can be your front-end too.