

What programming language to learn RoR or PHP? - jonjonjon

I want to learn a programming language that would help me quickly prototype ideas. I am debating between Ruby on Rail or PHP. Could you guys share the pros and cons and your personal advice?
======
patio11
Ruby is a programing language. Ruby on Rails is a web framework. That is not a
pointy-headed distinction, because the reason Rails is vastly superior to
regular ol' PHP for certain types of prototyping tasks is because of all the
stuff it has built _on top of_ Ruby. For example, ActiveRecord, which will
save you from having hard-coded SQL calls in the middle of your prototype.

There is a certain amount of conceptual overhead which happens with Rails
projects that doesn't happen with PHP. Deploying Rails apps is still an order
of magnitude or more harder than doing PHP apps -- even with Passenger, which
supposedly fixed deployment. There will almost certainly be more configuration
in a Rails app.

On the plus side, the Rails and Ruby communities have _wide and deep_ amounts
of OSS code for you to use to accomplish typical web dev tasks. The PHP
community is, ahem, well, I'm sure they're wonderful people and if you're
working _on Wordpress_ they have huge amounts of well-packaged code available
for you to use to accomplish your tasks.

You don't mention if you're a programmer already. PHP is well-suited to folks
with minimal programming ability. I would think doing Rails without having
strong object oriented programming skills would be a recipe for disaster.

~~~
ph0rque
I mostly agree with you, except for two points:

For prototyping purposes, deploying to heroku is as easy as

    
    
      git push heroku master
    

Also, I learned Ruby as my first language... learning OO was no harder than
learning other programming concepts.

------
yourabi
PHP? Avoid it.

Look into Python and Django or Pylons.

In my opinion Python has a better culture and community. You will also be
exposed to functional topics like list comprehensions and generators that you
are unlikely to come across in PHP.

------
gmlk
If you can avoid the mess that is PHP, do.

Don't ever try to build something in PHP that needs to be clean and clear.
Messy and obscure is easy in PHP, clean and clear is hard, therefor the system
will be working against you all the time.

However, you can't always avoid it. Sometimes you just can't use anything
else.

RoR has as down side that it requires a lot more control over the server then
PHP does. Also, you need to learn to think in RoR's MVC model. It you can, RoR
will be a great assistent helping you along the way. If you can't, it will be
as helpful as a bureaucrat.

------
dget
While PHP is incredibly messy, if you already know HTML, I'd go with it.

It's a fairly gradual step up from static HTML/CSS, and will probably be less
frustrating at the start.

------
Wolf_Larsen
I think it depends on your ideas as much as anything else. Web Apps? Operating
Systems?

For web apps, I love Drupal. Drupal is a php platform, like Rails is for Ruby.
PHP was easy enough for me to be building simple Drupal modules within a year
of my first install, with Very little prior experience. So, keep in mind that
php is not a huge learning curve and you also have jQuery, Apache, linux,
project management, etc out there, fucking up your life, ;D

~~~
jonjonjon
thanks. How far can you go with drupal? what is the more extensive/impressive
implementation on Drupal that you have seen?

~~~
Wolf_Larsen
You can go very far. Facebook apps, mobile apps, SMS, Mapping,

Here are some impressive implementations: <http://www.drupalgardens.com/>
<http://openatrium.com/> <http://groups.drupal.org/aegir-hosting-system>
<http://developmentseed.org/> -> Their projects are cool
[http://drupal.org/project/modules?filters=drupal_core%3A87&#...](http://drupal.org/project/modules?filters=drupal_core%3A87&solrsort=sis_project_release_usage%20desc)
-> Modules organized by usage. Go through a few pages to see some specific
use-case modules. [http://2bits.com/articles/presentation-28-million-page-
views...](http://2bits.com/articles/presentation-28-million-page-views-
day-70-million-month-one-server.html) -> Drupal is NOT slow when configured
properly. www.whitehouse.gov is probably pretty cool.

I recommend <http://sf2010.drupal.org/conference/sessions/state-drupal> for an
idea of where Drupal is today.

I'm curious what other HN people think about Drupal. Would love to hear.

------
phoenix-project
You might want to try Python instead of Ruby or PHP. If you are willing and
have the time, do give Smalltalk a shot too.

~~~
brianto2010
Why? If you are going to give a position, _at least_ back it up.

@jonjonjon - I'd suggest finding a quick mini-project tutorial for both
languages and do them. Afterwards, see how both languages _feel_ and judge it
yourself. For Ruby on Rails, there is the _Rails Tutorial_ by Hartl

<http://www.railstutorial.org/>

I don't know of an equivalent for PHP.

~~~
jonjonjon
will try that. thanks! Interested to see if anyone can suggest the equivalent
tutorial in PHP?

------
eswat
Try a very quick project with both languages? Maybe a todo list using
Ruby/Rails and PHP/CodeIgniter (language/framework). Not really answering your
question but you should also see how these two work with your own eyes instead
of just relying on anecdote, even if you’re just starting programming.

------
spooneybarger
Ruby on Rails isnt a programming language. Its a framework for web
applications written in Ruby.

------
armandososa
I'd say, if you are not very comfortable with the command line, sockets, ENV
variables and that kind of unix-y stuff do yourself a favor and grab MAMP or
XAMPP and start programming PHP right away.

------
bbastian
I'd recommend avoiding PHP. For quick prototyping, I'd recommend Rails, though
(in my opinion) Ruby/Sinatra or Python/Tornado would be better overall.

------
techiferous
Would this be your first programming language?

~~~
jonjonjon
Yup,but I have been exposed as Product Manager to the process of programming.

~~~
techiferous
If this is your first language, then keep this in mind: it is like learning a
new human language in that you have to learn the grammar and you have to learn
vocabulary. Let's say you choose Ruby on Rails. Ruby is like learning grammar:
you've got to understand the core concepts of the language and how to put
things together. Rails and the domain of web programming is like the thousands
of vocab words you need to know: HTTP status codes, the CSS box model, Rack,
XHTML, Ajax, cross-site scripting, etc. Web programming encompasses a lot of
knowledge. You may be able to pick up Ruby pretty quickly, but it will take a
while to learn all of the web programming knowledge you need to know to
program a web app adequately. Time and time again I've seen people think it
was easy, dive in, and realize it was really hard. I'm not trying to
discourage you, but realize it's going to be a lot of work (probably similar
to the effort of learning a new human language).

~~~
jonjonjon
I understand. I do now HTML and CSS and have played a bit with javascript. But
yes, I a am aware how difficult and time consuming this will be. Would you
then recommend RoR over PHP?

~~~
techiferous
I wouldn't recommend Rails as a starting point. The ecosystem has become quite
large and there is a lot to learn. Plus, it's in transition from Rails 2 to
Rails 3, so you'll be learning a moving target and the ecosystem is a bit
unstable as a result. If you'd like a Ruby framework to start with, I'd
recommend Sinatra. It has less moving parts but is still plenty powerful.
<http://www.sinatrarb.com/>

If your web application is mostly a web site with some dynamic features
sprinkled in, then PHP would be a good choice because it's easy to embed
straight within the HTML. If you're building a full-fledged web app (lots of
dynamic content, database-backed, user accounts, etc.) then I would choose a
web framework. I don't know how PHP web frameworks compare with Ruby web
frameworks since I haven't used a PHP web framework myself.

------
wendroid
Visual Basic sounds right for you

