Archive

Archive for October, 2008

Wrapping things up in Chennai

October 31, 2008 Ryan Garver Leave a comment

This trip has been a blast.  I really hope I can come back here.  I’ve decided that I’m not much of a camera person and the next time I travel I need to bring a video camera or something.  I keep not knowing what to take pictures, and then I realize that I just want to capture the whole thing to show people.
Read more…

Categories: india08 Tags: ,

Happy Diwali!

October 26, 2008 Ryan Garver Leave a comment

I was awoken this morning at 4:30am to loud fireworks going off.  The most obvious source was about 100 feet down the road from my window, but I eventually heard the entire city erupting in explosions.

I was half expecting this when I went to bed.  Yesterday was filled with it’s share of random fireworks being set off in the street.  Sriram warned me to keep an eye out if I go out on foot because you never know where these things will go off and people will assume you are alert.  Today has been a constant barrage of fireworks all around the city.  It is now almost noon and the fireworks haven’t stopped for more than 30 seconds, and that was a notable lull.

Diwali is celebrated here as the day that Lord Krishna defeated the demon Narakasura.  The fireworks symbolize this defeat.  Apparently elsewhere it has different significance, but equal festivities.  The holiday is also referred to as the “Festival of Lights” because during the days before, during and afterward, people place oil lamps in all of the corners of their houses to drive away the darkness.  In fact last week it wasn’t uncommon to see people’s computer desktops adorned with animated oil lamps in the corners of their screens.

Another significance, at least here, for Diwali is that it is supposed to be the day that all water is coming directly from the Ganges.  By washing in the Ganges river it is believed that all of your sins up to that point are washed away.  Because all water today is to have come from the Ganges people take a bath and then put on new clothes to mark that their sins have been washed away and that they are starting anew.

Sriram is going to try and take me around to see some of the celebrations.  His aunt died earlier in the year and according to tradition his family is not supposed to celebrate any festivals for one year.  This leaves him a little more free today to be my tour guide, which is very nice of him.  I hope to have some pictures at the end of the day to show what this is like.

Categories: india08 Tags: ,

Data Driven vs Logic Driven

October 25, 2008 Ryan Garver Leave a comment

My recent work has had me diagnosing some fairly common issues that one sees from developers moving from a language like PHP to Ruby on Rails.  The PHP philosophy (as I remember it) is to not restrict how you work and to seamlessly weave your code and your views together.  For very small websites this is fine.  I’ve even been told that this works really well for situations where most of the work is happening elsewhere (think Actionscript and Flash), which forces a kind of modularization.  Regardless we end up with lots of code and the persistence/database ends up being where we put things to remember them.  I’ve started calling this logic-driven design.  I’m not sure if I’m stealing someone else’s term, but it communicates the essence of the idea.

Logic-driven Design
To me LDD has a few key markers that make it stand out:

1. The persistence engine is used to store data and little bearing on the logic of the larger system.
1. There is no abstraction layer in which to place business logic.
1. The business logic emerges out of the flow of logic, rather than from some modular abstraction.

Most PHP programs that I have looked at fall in to this category.  Only as the project size grows past a certain complexity does one see PHP projects with more explicit abstractions around the persistence layer.  The reason this is done is because at a certain size in a project a programmer can no longer track all lines of logic in their head and continue to develop the application efficiently.

Data-driven Design
This addition of an abstraction layer around the persistence engine that is used for managing business logic is what has been called data-driven design.  This is obviously not a new idea.  In fact one of the points of pride for me in using Ruby on Rails is it’s particular grace in working in this manner.

Data-driven design aims to drive the logic and output of the application directly from the persistence engine; the data source.  The convenient side-effect of this design approach is the adjustment of most of the business rules and how the application behaves is matter of changing records in a database.

PHP to Ruby on Rails
Ruby on Rails employs an MVC architecture.  This architecture is designed to support data-driven design by providing a powerful abstraction layer for the persistence engine (the model).  Rails has a particular sweet spot for social web applications for this reason.  The framework excels in user generated content, as this is a form of data-driven design.

Developers moving from PHP to Rails often miss this shift in thinking when they make the jump.  The result is code that is primarily located either in the controller or the view layers, since this is analogous to PHP’s logic-driven model.  The end result is very heavy controllers with big functions that do a bunch of logic on database records, and then render it out to the user.  In this paradigm the Rails models are only used to retrieve the record and nothing else.

When Rails moved from solely MVC to a resource-based approach a few members of the community had some negative feedback.  Some people feel like the resource concept makes development in Rails more complicated.  What I’ve seen in practice however leads me to believe that the real difficulty with the resource based approach is that it forces you to make the jump from logic-driven to data-driven.  PHP style development becomes contradictory in a resource based rails application.  Instead you have to think about the “resource”, the entity that will affect and be affected, and build your application around that.

Categories: software design

Mahabalipuram

October 20, 2008 Ryan Garver 1 comment

So this weekend was amazing.

On Saturday afternoon Sriram took me out shopping and touring around Chennai.  It was very neat.  The city is big and I got to see first hand how traffic can get.

Read more…

More to come…

October 19, 2008 Ryan Garver Leave a comment

I’m getting ready for work right now and hoping that my pictures will make it up to Flickr before I have to pack up to go.  I’m going to write about my weekend this evening (my evening) so look forward to the next installment when you wake up!

Categories: india08 Tags: