Web 2.0: Day 1 – Workshops

So today was the start of the Web 2.0 Expo for those of us attendees registered for the workshops. The official beginning tomorrow for the other sessions and expo hall.

I’m slowly getting used to Pacific Time, thought it’s 10pm here and I think I’m still about 1-2 hours off. So the workshops…

The Iterative App: From Discord to Design

The day started with Kelly Goto – a favorite author of mine who wrote “Web ReDesign” which was all about merging User Centered Design with Agile Development Methodology. It was the biggest high I had received in a long time when I was sitting there in the audience and here this author that I respect so greatly was pushing the same techniques and still that I’ve been trying to evangelize. The idea that you really need to target your users emotional usage of your product more then anything for it to me successful. That you just need to “pick a feature” – and start with just that feature it in the beginning building off of that along with what you users actually are doing with your product. Her example was Flickr talking how it originally began as a gaming platform, but everyone was simply using the photo sharing portion – so it evolved with how people were using it. Products most evolve of time! Small pieces growing toward a closer idea of what the user NEEDS (not wants). She uses a great quote from Henry Ford of, “If I would have asked people what they wanted, they would have told me a faster horse.” Products must solve a “need” and not be created from a “want”. Plus she filled in a lot of hole in my of my methodology theory that involved research and testing.

The second half of her workshop was a little touchy as many of her slides where out of place and we were running late. Thankfully she promised all the finished slides would be available at a special URL for our usage and study. She even hinted at another book grouping UCD ideals with Agile rather then the previous “Core” framework she previously developed. I’m highly looking forward to seeing that come to market.

All in all, but myself and the other architect with me that attended Goto’s workshop released at every level that our process just wasn’t cutting it in the real world.

Ruby on Rails with David A. Black

I wasn’t sure what I should expect from David’s workshop so I walked in pretty open minded knowing I would now have an outlet to have many of my questions answered. The room was filled with Java programmers looking to prove Java better as a language. I felt bad for them. Here they are in their J2EE world and this little language has been growing and taking many Java jobs away. The wanted to stand up for their language. So many questions came regarding performance and if Ruby could actually be faster the Java or even compare to it. David was very patient and answered all of their questions as best as we could without he, himself being a Java Developer.

After the presentation we took a break were David fielded some questions prior to him taking a break himself. As I was answering one gentleman’s question regarding development with Ruby and Rails I found myself with a growing audience from all areas of the world. Here I was, little ol’ me talking to PHP programmers, Java Programmers, .NET Programmers, C Programmers, and even a single ColdFusion developer. I only hope that I articulated the benefit of Rails well enough, but it felt good explaining my point of view on Rails and to get feedback from other developers.

Once we regained the group together it was time to write some Rails code. I spent some time with David asking my small questions that I just couldn’t get my head around which he handled willingly and I feel far better equipped to deal with certain application types now. But I think too he was happy to have someone there that could “get his back” because he didn’t feel right about defending one language over another. He also showed me some great things in TextMate that I can use when developing Ruby which I didn’t know before. It was definitely worth it to me to go because I got to see what I knew, and have questions answered that I just could figure out before.

So day 1 was great. I even got a free O’Reilly book that I’ve been wanting called “Designing Interfaces” – essentially a usability book. Tomorrow morning beginnings the sessions where I will be seeing Kelly Goto again regarding the “Hybrid Designer” along with Mike Chambers from Adobe regarding the new Apollo application. I’m going to try to get some of his feedback regarding the new features in Firefox 3 regarding local data storage along with Joyent’s Slingshot framework. I hope to really get a solid understanding of what the benefits of Apollo will be in comparison to what these other’s are doing.

Until tomorrow…

Advertisement

Getting Ready for the Web 2.0 Expo

So I’m currently in San Francisco awaiting for the Web 2.0 Expo tomorrow morning.  The flight into Phoenix was a little late requiring a run to the next gate only to find out the plane that I thought was leaving in 4 minutes was about to officially have a delay announcement made.

Flying into San Francisco was a little bumping due to weather, but we landed about 1:00PM PST.   After an interesting drive from the airport to the hotel we all realized that our hotel was a little more “interesting” then originally expected.  With no A/C, no frig, a view that looks into the other rooms about 5 feet over an alley, and a gentle smell of mothballs it definitely has us wishing we were back at the Marriott in the Tampa Airport where we spent last night.

Tomorrow will be with registration and then breakfast. 9:30 begins the Expo workshop day.  A morning workshop with Kelly Goto regarding development process and an afternoon workshop with David Black regarding Rails.  Monday beings all the keynotes that will take us through Wednesday.  While I am looking forward to learning great new things with the my trip has it is currently I find myself already looking forward to the flight home.

Preparing for CSS Naked Day with Ruby on Rails

So you are sitting there around the house watching reruns of Smallville and Seinfeld and you think, “I wish I could jump onto the CSS Naked Day bandwagon with my Ruby on Rails application”, well you are in luck. Conditional statements in Rails are a piece of cake and with logical expressions like “unless” we save ourselves a ton of code.

In our layout when we call our stylesheet link tag we would just add some conditional code to the end like this:

<%= stylesheet_link_tag "default"
unless (Time.now.month == 4) and (Time.now.day == 5) %>

And that’s it, show the stylesheet unless it’s April 5th. The carriage return is for the blog, this can go on one line. I do have to say, be nice to your users here, you just might break the shit out of some of your UI without your CSS. Most Rails applications have more then just a blog on them so I suggest not doing this on a production application (do I really need to be saying this?).

DRYing Up Our Testimonial Partial

So for those of you that ran through the and created your very own random testimonial helper, I’m going to create another help to and were are going to make a few updates to our partial. First we have to do a few things:

  1. Rename our _random_testimonial.rhtml partial to _testimonial.rhtml
  2. Open our partial and remove the random_ from lines 2 and 3 leaving testimonial.[object]
  3. Open our application_helper.rb and edit out random_ on the line rendering the partial.
  4. Give the code a test

Everything should be just fine. All we have done is removed the usage of “random_” when it comes to using our partial. All the other code is the same here. So why would we do such a thing? Well… what if we had a page that we wanted to show all of our testimonials on? We already have a perfectly good partial view – we might as well take advantage of it. So in my testimonials_helper.rb I make another helper as such:

def all_testimonials
  @testimonials = Testimonial.find(:all)
  render(:partial => 'shared/testimonial', :collection => @testimonials)
end

Notice how I’m using the same partial here. Now in my testimonials controller I’ll just create a blank index method. The in my view testimonials/index.rthml I’ll just call the <%= all_testimonials %> helper.

Now I can use the both helpers with the same partial depending on the output I’m trying to active.

Now granted, we could use a method supporting polymorphism to DRY this up a little more, but I’ll let you experiment more with that yourself, when it comes to displaying testimonials on a page I don’t think I’m going to take the code THAT far.

Solving the Fizzbuzz Puzzle with Ruby

So back in February Jeff Atwood over at codinghorror.com was talking about a puzzle to give prospective new-hires when interviewing them entitled “Fizzbuzz”. You can read more about it here.

So with a little thought I decided to solve the fizzbuzz puzzle using Rudy and an Array.

count = 0
100.times do
  count += 1
  fb = []
  fb << "Fizz" if (count % 3) == 0
  fb << "Buzz" if (count % 5) == 0
  fb << count if (count % 3) != 0 and (count % 5) != 0
  puts (fb.join "")
end

For those of you that are curious as to why I used a local variable of count rather then the index identifier, is because the article by Jeff Atwood requests a loop from 1-100 and Ruby starts looping at 0.

Random Testimonials with Rails

A common functionality seen on many websites is to display a random testimonial from a client or customer of your product on a side bar or within the masthead, doing this in Rails is quite simple and is done with the assistance of a Rails helper and rendering a partial.

First off course you are going to need to generate your model within your command prompt/terminal insuring that you are in your projects directory:

script/generate model Testimonial

I’m expecting here that you are familiar enough with rails to create the migration file yourself and add a field for both the testimonial itself as well as the signature. Note Rails currently at 1.2.3 has an issue when using the name “quote” for a column name in your table.

Next let’s code the helper. In our helpers folder let’s open the application_helper.rb and add the following:

def show_random_testimonial
  @random_testimonial = Testimonial.find(:first, :order => 'RAND()')
  render(:partial => 'shared/random_testimonial', :object => @random_testimonial)
end

I like to put all my partials in a separate subdirectory in my views called shared.

Alright, so now create that shared directory in the view directory and create the file _random_testimonial.rhtml to use as our partial. Here we go:

<blockquote>
  <p><%= random_testimonial.statement %></p>
  <cite><%= random_testimonial.signature %></cite>
</blockquote>

You’ll notice above that I called my column for the testimonial itself “statement” which is a text field, and “signature” for the customer’s name which is a string/varchar. Now all you have to do is open up your layout file and call the helper <%= show_random_testimonial %> wherever you want your random testimonial to appear.

So that’s it. Until next time.