Giving Seth Godin a Ride to the Airport 3

Posted by Jimmy'z on May 25, 2007

Yesterday, Brian and I were given an opportunity of a lifetime. We were able to go and hear Seth Godin speak about his new book, The Dip, in person. I was really excited about this, and grateful for all of the work and effort that Phil and the Word Mob team had spent to make it happen.

I thought the event was handled really well, and it was great to mingle with other Utah professionals that share similar interests. Before Seth arrived, Patrick Byrne – the CEO of Overstock, and Judd Bagley gave a small presentation on Omuse and the goal it has in bringing together communities that are protected from sabotage.

When Seth came into the room, it was cool to see Patrick Byrne’s face light up and say with a smile, “Here’s Seth.” Patrick was standing off to the side of the stage at that time.

Anyways, Seth gave an awesome presentation on overcoming mediocrity and becoming a superstar by becoming the best in the world at what you do. I’ll write a little more later about my thoughts on the presentation, as I compile my notes together and put more thought into it.

As Brian and I were leaving the Salt Palace, we saw Seth on the side of the road flagging a taxi, and Phil pushing a Mercedes SUV out of traffic. We quickly turned around and offered to help out. Seth and Phil hopped in my humble little Honda Accord, and we raced off to the airport. It was pretty crazy in the car at first as we disputed about the best route to the airport. Read Phil’s story, it will give you somewhat of an idea of what went on.

The coolest part of the whole experience is that we got about 5 minutes of advice time from Seth pertaining to our new little company, Apriux. If hearing Seth speak live was an opportunity of a lifetime, I don’t know what I’d call this. It was incredible. Thanks Seth!

I feel bad that Phil’s day finish off as well as he’d hoped. He did pull off an extraordinary event. Hopefully he’ll get some more time with Seth another day.

Programming Heroes – The Rails Core Team

Posted by Jimmy'z on May 19, 2007

Monsters Inc. is one of my favorite Pixar films. I love the slow-motion scene where the monsters are walking into the scare-portal room to begin work and the young intern monster says in his teenage voice, “Wow! They’re so awesome!” That’s how I feel about the core team behind Ruby on Rails.

I spent a little bit of time this week reading through the profiles on each of the core team members and found myself grateful for contributions that each of the members had made. Each one contributed something new and innovative to the web development community. Each one has made our work as developers hurt less.

David Heinemeier Hansson kicked it all off by sharing with the world his framework that he so ingeniously created while building Basecamp. He’s a true pioneer of the web who journeyed away from the comforts and frustrations of php to a marvelous yet-to-be-taken-seriously-on-the-web language of ruby. Ruby is now my weapon of choice, but I’m convinced that I would have never discovered it without rails.

Sam Stephenson and Thomas Fuchs have made building web interfaces fun. Sam is responsible for fixing Javascript with his Prototype.js framework. I used to hate ever doing anything with Javascript. Since discovering Prototype, I actually enjoy Javascript programming. Thomas developed the awesome script.aculo.us visual effects, controls, and ajax libraries. Script.aculo.us is built on top of the prototype.js. Script.aculo.us makes it possible to build cool Web 2.0 applications. These two libraries together are incredible.

Jamis Buck writes an awesome blog on rails tips and tricks. He’s the genius behind many Ruby libraries for web communication. He’s contributed some awesome libraries and plugins, including Capistrano. He graduated from BYU, my alma mater.

Finally, to everyone who has contributed to making our lives better, THANK YOU!

Why I Prefer Ruby on Rails over CakePHP 28

Posted by Jimmy'z on May 19, 2007

Last year, I had a goal to learn Ruby on Rails and build an application in that framework. By learning CakePHP, I was able to wrap my mind around the rails framework concepts and make that transition a little easier. This year, I have made the full plunge into the Ruby on Rails, and I absolutely love it. As I’ve made the transition from php to ruby and from CakePHP to Ruby On Rails, I’ve written down some of the reasons why I now use Ruby on Rails over CakePHP.

[note: I still prefer to use CakePHP over no framework if a client requests an application be written in php. However, when we have the option to start the project in Rails, we really push for rails.]

Here are some of the reasons why I prefer Ruby on Rails over CakePHP:

Rails doesn’t require you to grab all of your data in the controller

When working with CakePHP, you must retrieve all of your data from the database in the controller and pass it all to your View. All of this data is stored in an associative, which makes accessing your data very easy, but lacks the functionality of using an object.

All of the data that you will need from associated models must exist in the array(s) that you pass to your view. You can grab data from associated models this by using Cake’s recursive option which will grab all of the data in surrounding models.

Lets say that you have an Author that has many Articles, Articles have many Comments and you would like to grab the Author, her articles, and comments to give to the view. You would do this with the recursive option of 2 levels of data retrieval. However, lets say that the author also has many books and books have many chapters. When you do a recursive find on the author, it will grab all of the articles and comments, books and chapters. This leads to a lot of wasted data retrieval

With Rails, you can easily walk through the data models while your are in the view, and if the object doesn’t yet have that data, it will automatically query the database behind the scenes. This is a beautiful thing. So, in the controller, you only have to grab the author. In the view you can then walk the model in the following way:

author.articles.first.comments.first.email_address

Of course you can iterate through the articles and the comments, but you can continue to move to associated models all you want. Also, to save queries to the database, you can do an eager find and specify that you also want her articles so that the articles are also returned in that first query. That is super powerful!

Rails model objects allow for dynamic attributes

Lets say that you have a User model that has the attributes of a first_name, and last_name. When displaying this information, you often want to show the full name. You might just output the first name then the last name every time, but wouldn’t it be nice if you just had a full_name attribute? In rails you can do this by defining a new method named full_name on the User model which returns the formatted full name. In Cake you can’t do this because you only have an associative array.

Lets say that the users have an image associated with their record. The image path on the server can be derived by their user id and an image extension which is stored in the users table. The path would be /images/users/[id].[image_extension]. In Rails, you can define a method on the User model named image_location which returns the formatted path. In Cake, you would have to formulate the path inside the view every time you wish to display it.

Further, if the user had no image, you can check for that inside your image_location method for the image_extension and return a no_image.gif when appropriate. In Cake, you would have to wrap some logic around your image display inside your view which makes it much uglier and prone to bugs.

Rails Has Superior Url Routing

[UPDATE: Ben has just notified me that Cake has now added similar routing capabilities. See his comment.]

Rails has amazing routing capabilities. At first glance, it appears that Cake can do everything that Rails can do, but it can’t. One of the main differences is that Cake’s routing is a one-way routing. Another difference is the way that Cake handles parameters passed to the controller.

One-way routing

Cake’s routing is one way, meaning that you set up your routes in the configuration, and then you must remember your url structure and write the urls yourself throughout the application.

For example, if you are building a social application which features personal profiles. You decide to name your controller ‘Person’ and the action to view the profile ‘view’. Each person is identified by a unique id, so you decide to use the default routing in cake and rails which would give you a url of /person/view/33 for person #33.

Throughout your Rails application, you’ve linked to the personal profile pages by calling link_to(persons_name, :controller => 'person, :action => 'view', :id => persons_id). This builds a url using the default route /person/view/[id].

Throughout your Cake application, you’ve linked to the personal profile pages by calling echo $html->link($persons_name, "/person/view/".$persons_id); . This also gives you the same url: /person/view/[id].

Down the road, you realize that you would like to make your urls more friendly, and represent personal profile pages with a url like: /friend/[id].

In rails, your new route looks like this:

map.connect "friend/:id", :controller => 'person', :action => 'view'

In cake, your new route looks like this:

$Route->connect('/friend/*', array('controller' => 'person', 'action' => 'view'));

It appears that Cake can do everything that Rails can do, but what about all of your urls that you have scattered throughout your application. Rails will automatically write them to fit this new routing pattern. Cake makes you find all of your links and change them by hand.

Rails has two-way routing, where Cake’s routing is one-way.

Parameter handling

[Correction here: You can accomplish similar parameter handling capabilities with Cake. This becomes a null point. You can still concatenate a querystring to the end of the url and use $this->params['url']['param_name'] to retrieve your parameters].

Cake handles parameters on the url differently than rails. With Cake, your parameters are listed like so /find-person/[param1]/[param2]/[param3]/[etc.].

In your Cake controller, you accept the parameters like so:

function find_person($name, $city, $page)

The order in which they appear on the url determines which parameter they become in the action.

Rails checks to see if the parameter matches a url definition in its routes, and if it doesn’t fit there, it will append it to the end of the url in a querystring like so: /find-person/?name=x&city=Provo&page=3.

In your Rails controller, you would access the paramters like so:

def find_person
name = params[:name]
city = params[:city]
page = params[:page]

You might think that Cake’s way of handling the parameters is superior because it keeps the url looking prettier. However, this can be a real pain if you are writing an advanced search where any of your parameters can be optional. It’s also nice to be able to use a form with the method=GET for search. I don’t know of a way to do this in Cake. See the above message on how to do this in Cake.

There are still other reasons for using Rails over CakePHP, and there are some reasons why clients will still prefer to stick to php. What are some of the reasons you prefer CakePHP over Rails or Rails over CakePHP?

Google Analytics’ Customizable Dashboard

Posted by Jimmy'z on May 10, 2007

Google has opened up a beta release of their New Google Analytics interface. At first I was pretty disappointed because I couldn’t see what new real value the interface provided other than flashier graphics and better styled reporting. However, after a more thorough use of the tool, I discovered that there are a few new killer features that do add value to the product. My favorite of the new features is Google Analytics’ Customizable Dashboard.

The Customizable Dashboard

The new Google Analytics customizable dashboard provides much more value to the customer because you can get a quick glimpse at the information that you deem important. For example, say that I’ve targeted the key-phrase “making money in second life” in one of my posts, and I want to know how much traffic that phrase is bringing me from Google. I can watch that right on my dashboard.

Google traffic - making money in second life

To get this report, I clicked “Traffic Sources” => “Search Engines” to bring up the search engine report. Then I clicked on the “google” link, which automatically cross-segments Google visits with the keywords that brought them here. I further clicked on the phrase “making money in second life,” which gives me more detailed statistics of that key-phrase and trends those visits over time. I narrowed the time frame to the last week, and clicked the “Add to Dashboard” button towards the top.

Now I can follow this keyword performance right from the dashboard. I can even jump back to that report by clicking the view report link. This seems to be the only way of bookmarking favorite reports.

How does this feature compare with Omniture Site Catalyst’s customizable dashboard? The main difference here is the ability to customize the actual reports. Site Catalyst gives much more flexibility in the reporting itself, so you can really tailor the reports to your needs. This is where the real value of Site Catalyst lies.
I don’t think Google Analytics will ever match reporting flexibility of Site Catalyst because Google is serving a different segment of the market. Site Catalyst is so expensive, that only the big boys can afford it. It is also so complex that the average user needs training to learn the tool. Google Analytics is targeted towards the average website owner and fulfills most of their needs.

I’m excited to see that Google is continually improving this tool. Thanks Google.