Gaydar Seen for South Dakota Births Rails Recipes: Stuff you need
Apr 18

PHP and Ruby: Evolution before Revolution

Tech Add comments

It has been a pleasure to use Rails for web applications that are suited to it, especially green field applications.

But not all projects are green fields, and what if you want to be able to use Rails in those?

I am experiencing this scenario right now. A project in production that uses PHP wants to ramp up to the next level and the new features are suited well to Rails.

That being said, we don’t have time to stop new features for a few months while we rewrite the application in Rails. It isn’t sexy to do a relaunch and say to the company “look, the app runs exactly the same but it is on cool technology!”. They don’t care :)

Migration via Web Services

A lot of the new projects are suited as Web services. Instead of having Rails be in charge of everything, the PHP front end can talk to Rails to display the functionality. Rails 1.1 is very good at this, and it is easy to write your application to deliver JSON, or XML, or HTML.

Phase One: PHP can include some HTML, or use the XML output. In the future as we get rid of the PHP code we can simply use Rails to deliver the full HTML.

Migration via ‘Portal’

The PHP front end can also proxy through to the Rails applications running behind the scenes. This makes the app feel a little like a portal, but basically it is just a proxy. The front end can build the template (header, footer, sidebars) and then call back to the Rails backend to get the main content.

This is where SiteMesh for PHP would be nice :)

Chipping away

As we add new features we can put more and more into the Ruby codebase. The front end system can be replaced, while we leave the admin application still running on the PHP side. After all, the data is all just shared at the DB level.

At a later date we can then go back and migrate the admin app. We can do this at a point when new functionality is requested at the admin level, and can role it in.

It would be much nicer to be working in pure Rails world of course, but it is an interesting experience to ease it into a production environment, and see it eat out PHP from the inside.

JRuby on Rails

What about when I need to do the same on a Java project (e.g. use Rails and use the Java code).

Luckily, JRuby on Rails is creeping along nicely.

3 Responses to “PHP and Ruby: Evolution before Revolution”

  1. Graeme Rocher Says:

    You could always use Grails: http://www.grails.org ;)

    It can be mapped onto legacy database systems.

  2. Stefan Says:

    http://www.chujek.pl handjob [URL=http://www.atore-pornos.vajinaes.com]atore
    pornos[/URL]

  3. Stefan Says:

    http://www.chujek.pl handjob [URL=http://www.atore-pornos.vajinaes.com]atore
    pornos[/URL]

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: Type in the word 'cricket'

Loading...