PHP is a mess, yes, but you can get things done, which is all that matters.

Saturday, June 18, 2005

Deleting …Approving …

I like Python. Ruby has too many syntactic elements for my taste. I haven't tried any Python-friendly hosts, but TextDrive and python-hosting.com both look professional and have good prices. There is a Rails-ish framework for Python called Subway that I've been planning to try.

PHP is a language, Rails is a framework. To some extent, you're asking us to compare apples and oranges.

Comparing languages, Ruby is a general-purpose language with a lot of influences from Smalltalk, Perl and other dynamic languages. PHP is a special-purpose language and, although it has improved a lot over the years, it still doesn't lend itself to the full range of object-oriented programming that Ruby does.

Your stereotypical PHP site is a bunch of pages glommed together, a big ball of mud held together with goto statements. That works up to a point.

Rails really lives up to the name of a framework. You ask it to generate a skeleton application and customize it as necessary. It encourages you to follow some fairly well-known patterns, such as model-view-controller (MVC) and Active Record. Rails uses a number of conventions, so that if you know one Rails application, it should be fairly easy to understand the next one you come across. Hence, Rails has advantages when it comes to testing, making changes or adding features.

Rails also has canned solutions for a lot of common requirements.

Not that you can't do a lot of this with PHP -- it's just that Rails is designed to support its approach so that it's the natural way to do things.

Christian Murphy
Saturday, June 18, 2005

Deleting …Approving …

PHP is a language, Ruby on Rails is a web application framework.

Why don't you like Ruby?

What I like about it: blocks, no need to use parens on method calls (if unamibious, which is almost always), no need to put semicolons, good regular expression support.

My main reservation about Ruby and Rails is the new-ness. A language like Perl has had so many issues thrown at it over the past decade or more that, yes it sometimes looks like an awful mutant, but it also has CPAN. It's sort of like Joel's saying that "code doesn't rust." Old code may look gnarly, but that's in part to work around bugs out there in the real world. Ruby and Rails looks great and shiny but in part that it is because it is young and virginal.

PS On the other hand Rails is a pioneering Web rapid deplyment framework -- even Perl didn't have anything comparable until recently -- so in that sense it is actually more mature than other languages. But when you get into the specific things you want to do with your Web app (beyond generic content management, chat or online store) it is comforting at least to me to have lots of libraries to draw from.

what is the disaster that is php? Other than personal preference and some trivial to work around issues mentioned on your blog, do you have concrete issues with php? Real sites can be written and written quickly in php.

Can the same be said for ruby? So CRUD (create/read/update/delete) from forms to database is easy and builit in. That is not what makes an app complex. Kind of implies that it makes it easy for novices. The question is, can you do non-trivial things easily as well? Can you easily get around the framework when it doesnt do what you need?

hype or useful
Saturday, June 18, 2005

Deleting …Approving …

PHP is truly horrific - a badly-thought-out cumulative mess of a language.I say this as someone who's had to write quite a bit of complex web software in it. Not fun. Not even slightly.

Ruby I am just starting to learn but seems very nice and elegant, if you can forgive a few minor warts.

Sorry too lazy to go into details, but the article above on why PHP sucks pretty much sums it up.

What exactly do you mean by 'large'? Are you trying to say if it's not 'large' it's no good?

Joseph Huang
Saturday, June 18, 2005

Deleting …Approving …

Get around the framework? What for?

The framework imposes the model, view, and controller design pattern, and that's about it. You can use ActiveRecord to communicate with a database for data persistance, but that is optional.

Joseph Huang
Saturday, June 18, 2005

Deleting …Approving …

"The question is, can you do non-trivial things easily as well? Can you easily get around the framework when it doesnt do what you need?"

I'd say yes. To me, Ruby on Rails is what Cocoon could have been and so much more (no XML, less restrictive framework).

The defaults that the Rails framework imposes to speed up development can be customized. As well, you can configure one-off style controllers to handle requests that don't otherwise fit into the Rails paradigm easily.

The definitive answer to anyone's questions will, of course, be to sit down and play with the framework. May I suggest Agile Web Development with Rails, by Dave Thomas, as introductory reading? (link: http://www.pragmaticprogrammer.com/titles/rails/)