PHP vs Ruby is it worth it?

Hi, I’ve been searching around for what the best language there is out
there that is good enough to start learning if you aim to build a real
time website. From this search, I notice in a couple of spots an
argument between ruby and php and most of the arguments lean in favor of
ruby. I need your opinions and directions as to what I should look at
first, even if it is neither of the two. Please list all the other
necessary languages I will need to know and html being most basic,
please start from there with your list of languages i’ll need, from most
basic to the most complex ones i’ll need.

Do you intend to use a database? That’s really the first major question
which dictates your direction.

Between php and ruby, php has a faster “on ramp” for web development as
it
is geared first and foremost for this very thing. However, as nice as
php
is as a language in many respects, Ruby is a better programming language
and you’ll be much happier in the long run working with it.

In general you need to know HTML, CSS, Javascript and then a language
like
PHP or Ruby.

If you plan to use a database you need to know SQL too, albeit if you
use a
web framework like Rails, it hides the SQL behind an ORM.

On Wed, Feb 01, 2012 at 08:48:00AM +0900, Samuel M. wrote:

Hi, I’ve been searching around for what the best language there is out
there that is good enough to start learning if you aim to build a real
time website. From this search, I notice in a couple of spots an
argument between ruby and php and most of the arguments lean in favor of
ruby. I need your opinions and directions as to what I should look at
first, even if it is neither of the two. Please list all the other
necessary languages I will need to know and html being most basic,
please start from there with your list of languages i’ll need, from most
basic to the most complex ones i’ll need.

Keeping in mind that this is unvarnished personal opinion . . .

PHP is really easy to start using. It is really easy to continue using
badly. It is really easy to use in ways that get you in trouble with
software maintenance after your project grows a little. It is a
miserable language consisting of an anemic syntax with bolted-on lumps
of
silly putty mashed into shapes that look vaguely like the facilities of
superior languages, but aren’t.

There are frameworks for PHP that are, in essence, just a way to write
PHP with some of the heavy lifting and project origanization already
decided for you. A whole lot of PHP development for the web ignores
frameworks entirely; the stuff that uses frameworks tends to feel like a
cheap imitation of frameworks for Ruby, Python, and even Perl. In fact,
most PHP installs use mod_php for the Apache webserver, and expose PHP
as
a templating engine (in some respects like a web framework that is so
lightweight it’s not really a framework any longer). PHP is basically
not used for anything but web development.

Ruby is a beautiful language, pretty easy to start using, a touch less
easy to start using well, and very well-suited to writing maintainable
code at any scale of project. It has a history of being a bit slow, but
this is improving. Like any language, its design has shortcomings, but
for the most part it’s great, and great fun.

Rails is not the same thing as Ruby. It is a web framework that uses
Ruby, but uses it in ways that are not the same as idiomatic non-Rails
Ruby. It’s probably where you’ll end up if you do a lot of web
development in Ruby in a professional capacity. Ruby is an excellent
choice for web development using Rails, using some other framework,
using
a pretty bare templating engine, or for purposes entirely unrelated to
the web at all, in general.

I, like many others, used a few other languages for various purposes
before stumbling across Ruby. Ruby has mostly replaced them for me, and
has entirely replaced PHP for me – and I try really, really hard to
avoid PHP now unless someone is paying me to touch it, in which case I
just bite my tongue and get the work done so I can move on to other
things.

That’s one person’s take. I hope it helps.

I think many of us started doing web development in PHP (I started using
PHP in 1998ish or so) and switched to Ruby. I don’t think you’re going
to
get a lot of people specifically recommending PHP on this list.

For me Ruby is the clear choice and I never want to touch PHP again,
however for you there’s many things to consider. I don’t think Ruby is
for
everyone so it depends on the nature of your team and the nature of your
project.

Can you tell us more about what you are doing?

On Wed, Feb 01, 2012 at 02:59:29PM +0900, Samuel M. wrote:

well I want to build a real time website, exactly what languages should
be on my list to learn… i want to give myself this year and next year
to study whatever languages I have to learn then start working on the
project late next year…

My suggestion is Ruby.

There. Did that help?

well I want to build a real time website, exactly what languages should
be on my list to learn… i want to give myself this year and next year
to study whatever languages I have to learn then start working on the
project late next year…

I suggest Python.

On Tue, Jan 31, 2012 at 11:59 PM, Samuel M. [email protected]
wrote:

well I want to build a real time website, exactly what languages should
be on my list to learn… i want to give myself this year and next year
to study whatever languages I have to learn then start working on the
project late next year…

A question that I haven’t seen anyone else ask: what do you mean by
“real time website”?

This? Real-time web - Wikipedia

Or this? Real-time computing - Wikipedia

Or something else?

On Thu, Feb 02, 2012 at 02:36:44AM +0900, Eric C. wrote:

Or this? Real-time computing - Wikipedia

Or something else?

I get the impression it’s more like what people often mean when they say
“production” (e.g. “production server”).

more like how the facebook ticker works… if you know what i mean

On 02/02/12 08:58, Samuel M. wrote:

By “real time” I mean, having every activity occur synchronously on
every active machine viewing the website so that If I post something and
you’re on the website on a different computer, u don’t have to refresh
your page to see what I posted.

You probably don’t mean synchronously. If you required all your clients
to be synchronous, the speed of the site would be the speed of your
slowest client. The general approach to something like this is eventual
consistency; that is, your client (code shipped to user)
/asynchronously/ polls for (or receives via persistent connection)
updates from your server.

I imagine you will want to ‘learn you some Javascript’ irrespective of
which server side language or data store you choose for your
application.

Sam

By “real time” I mean, having every activity occur synchronously on
every active machine viewing the website so that If I post something and
you’re on the website on a different computer, u don’t have to refresh
your page to see what I posted.

It sounds like you want a publish/subscribe system which streams events
to
the browser.

There’s a number of different choices for that. I would recommend using
a
message queue of some sort to handle pubsub. RabbitMQ comes to mind.

For streaming events to the browser, try Cramp:

Keep in mind there are a bunch of different services that allows you to
do
this without
you needing to host (or write) your own server. It should not matter too
much what language
you use on your server-side for this.

A few examples of these are Pusher (http://pusher.com/), PubNub (
http://www.pubnub.com/)
or Beaconpush (http://beaconpush.com/).

— Kim Burgestrand