Learning from Rails

Well, we’ve explored the basics of Rails and are advancing along in our applications, what else is there for Rails. There are more advanced features of Rails including callbacks, observers and rich associations (ie. join models). In addtion, there’s more to controllers such as a more RESTful interface for Rails 1.1. There’s a lot more to RJS templating and other non-ERB templates (such as Liquid). Let’s not forget making your own plugins, rake tasks, benchmarks and finally deploying your finished applications.

Advancing with Rails

Deployment

Now that you have your applications going, how can you share them with the world? They can’t stay running in Webrick on your local machine forever. The answer to this is not very cut and dry. There’s a multitude of platforms and environments that you can run your application in, but here’s some tips:

Other Frameworks

Django

Django was developed around the same time as Rails and tauts many of the same leaps in productivity. It was built and extracted from the publishing world and from that has a handy admin interface that you get for free (much like scaffolded code in Rails). There seems to be some big changes afoot at the moment and Django should be better for it but there are no promises about backwards compatiblity until it hits 1.0. I walked through some of their tutorial and wasn’t happy with the a lot of the syntax. I’ve become fond of Ruby’s terse and concise syntax and some of the equivalent python code was pretty ugly. Some of that will or has changed with the upcoming release of 0.95, but I was working from the latest stable version 0.91.

Django is top-quality for highly scalable, high traffic sites though. Some points include a lack of AJAX/Javascript features and slight departure from the C in MVC. Lots of nice documentation. It also allows for easy management of multiple “apps” in a project.

Turbogears

From my brief flirtation with Turbogears, my first impressions were that it was much easier to pick up than the 0.91 version of Django (some of this seems to be fixed in 0.95 though). The syntax came out much cleaner and the pieces of the MVC puzzle fit more nicely with my Rails experiences. It fits python quite nicely in my opinion and I’d be interested in testing out it’s party line of being the “rapid web development megaframework you’ve been looking for.”

This framework is much younger than Django and is built on existing technologies. I’m not sure it’s been throughly tested on high-traffic sites.

20 Minute Wiki Tutorial

PHP on Trax, Biscuit & Cake

PHP on Trax, Biscuit and Cake are PHP Rails clones, and like many Rails clones they mimic Rails but can’t really reproduce the Ruby experience. Both projects may help spread the desirable practices learned from the experience of developing with Rails (such as unit testing, code separation and DRY practices), which is great even if less satisfying than the original.

PHP on Trax

Cake Tutorial

Biscuit Tutorial

PHP Framework Bits

Smarty is often used for templating in the PHP world. It allows you to separate out your logic code from your page views. DB_DataObject is the boring name for the PEAR project to implement ActiveRecord like functionality with a PHP approach.

Exercises

Homework (Due 2006-06-19)

Reading

Things to Try

Development Journal