Skip to content


Getting Started With OpenID

openid-logo

Recently, I integrated OpenID into the latest revision of the Cub Scout BragVest site and I think it’s truly the wave of the future. But, as of yet, it’s a highly underutilized technology so I wanted to give a brief overview of it here.

What is it?

The OpenID site has a good description to start with:

OpenID allows you to use an existing account to sign in to multiple websites, without needing to create new passwords. With OpenID, your password is only given to your identity provider, and that provider then confirms your identity to the websites you visit. Other than your provider, no website ever sees your password

So let’s unwrap this. In a nutshell, OpenID allows you to use your existing accounts at big sites (like Google, Yahoo, MySpace, Hotmail, Facebook and Twitter) to login to other sites. All without creating a new username and password.

You are simply redirected to the site of your choice to login and then securely redirected back to the original site with an authentication token. The original site never sees your password.

What Problem Does it Solve?

Imagine that you find a cool new site (like BragVest) and you want start tracking your cub scout achievements. But you don’t want to create yet another login and password. With OpenID you can login to that site using your existing account at Facebook or Google account. 

It also means that you instantly have an account at the new site. No need to go through a new account creation or email verification process. Pretty cool, huh?

How Do I Use It?

The simplest way to get started with OpenID is to use a widget like the one provided by RPX Now. It’s free for basic use and lets you choose up to six “providers” (Google, Yahoo, etc).

rpxnow

To get going, you just go to RPX now and create an account. Then they walk you through the following three steps:

  1. Generate Widget Code: RPX provides you with the code for a simple iFrame that displays their widget inline on your page.  It’s used to let the user select their provider in a user-friendly format.
  2. Receive Tokens: After the user has been authenticated on their favorite site, you will receive a token value. You use that token to make auth_info call and retrieve more data (email, username, etc) about the user. RPX provides you with sample code to do this in a variety of languages.
  3. Choose Providers: On the RPX site, you can choose which providers (Yahoo, Facebook, Google, etc) that you’d like their widget to display.

After that, you’re done!  I’m hoping to see more sites start utilizing openID so I can stop having to remember so many usernames and passwords.

Posted in Programming.

5 Things That ASP.NET Developers Would Love about Ruby on Rails

NetToRails

I’m a longtime ASP.NET developer, and indeed that’s how I’ve made my professional living for many years now, but I have to say there is a lot to love about Ruby on Rails.
There’s a simplicity and common sense approach that I really like.

I think other ASP.NET developers would enjoy certain aspects of Rails as well, so I put together a list of my 5 favorite things (in no particular order):

1) Migrations

If you’re like me, you really don’t like writing database change scripts in SQL. Wouldn’t it be nice if you could write the scripts in your favorite programming language rather than resorting to T-SQL? Well, with rails migrations you can!

You write your schema changes as a ruby class (or even generate them) and run it at the database to modify your schema. For example, to create a posts table, on the command line just type:

$ script/generate model Post name:string content:text

This will automatically generate the required class for you which looks like this:

class CreatePosts < ActiveRecord::Migration
  def self.up
    create_table :posts do |t|
      t.string :name
      t.string :title
      t.text :content

      t.timestamps
    end
  end

  def self.down
    drop_table :posts
  end
end

Then you just run “rake db:migrate” at the command line and your table is created. The framework even keeps track of which migrations have been run and versions them all so you can roll back to previous DB versions at any time.

2) Active Record

I love how active record does not force you to model out all your fields as properties. You simply build your table with migrations and then create a class of the same name that derives from ActiveRecord and Rails figures out the rest. No config files to set up or angle brackets to mess with.

It adds all the properties based on the table columns and a bunch of helper methods for finding records and working with the dataset, but your code is as simple as this:

class Post < ActiveRecord::Base
end

3) Opinionated

With Rails a lot of decisions are made for you and that’s a good thing! Instead of endlessly debating which of the 10 ORMs to use for your data layer, you just use Active Record because that’s what’s built-in out of the box and works for 90% of the cases.

Rails has a specific way of doing things, and if you buy into it, you can let the framework take care of a lot of the little details for you.

4) Lightweight

There’s something wonderful about not having to fire up a huge IDE to do development. Just launch your favorite text editor and start writing code. My personal preference for writing Rails code on windows is the E-TextEditor (which is modeled after TextMate), but I could just as easily use notepad++. 

This simply would not be possible with ASP.NET as there are just too many frameworks and libraries to deal with as well as just a lot of code to write that you almost need the IDE’s help to sort them all out. Not to mention, you need the IDE to compile your code (or the cmd line with hundreds of switches) which is not necessary in the the interpreted world of Ruby. The code and run cycle is almost instantaneous.

5) Less Code

After porting an ASP.NET MVC app to rails I was amazed with how little code it took in rails. The rails version was only about 25% of the code that was required for the ASP.NET MVC version.So, how is that possible?

Much of this is due to Active Record and the fact that I didn’t have to write any DB connector code, but also Ruby’s terse syntax and lack of strong typing just means that the amount of code you write is much less.

For example, a typical controller method in Rails looks like this:

  def show
     @post = Post.find(params[:post_id])
  end

And then @post is automatically visible in the corresponding view. Nice and elegant – the way coding should be.

Posted in Programming.

Can Programming be Art?

image

Lately I’ve been reading Seth Godin’s Linchpin. It’s an excellent book and the key point is that your work should be a platform for art:

Art [in this context] is a personal act of courage, something one human does that creates change in another. … I think it’s art when a great customer service person uses a conversation to convert an angry person into a raving fan. And it’s art when Craig Newmark invents a new business model that uses the Internet to revolutionize classifieds." …

Godin really expands the traditional definition of “art”; It doesn’t have to just be a painting that you hang on a wall, but it’s something that you create which directly impacts another in a dramatic and positive way.

Given that I’m a programmer, It makes me wonder in what ways programming and it’s output can be considered art– Is twitter art? What about facebook?

According to Godin, both of those sites would be art. They are unique and they have profoundly impacted people (as opposed to most software).

So a software product can be art, but what about an individual piece of code. Can that be art?

Obviously, O’Reilly thinks so given that they’ve published a book on the topic of beautiful code. I have to agree that some code and frameworks (eg - jQuery and Rails).are so elegant and  well-written that they are a true joy to work with.

It seems odd at first to be to lump programmers in with artists. Aren’t they two totally different types of people – one left-brained and the other right-brained? Yet, in many ways, they’re closer than you think.

Hackers and Painters

Paul Graham nailed this strange dichotomy in his classic essay entitled Hackers and Painters:

Hacking and painting have a lot in common. In fact, of all the different types of people I’ve known, hackers and painters are among the most alike.

What hackers and painters have in common is that they’re both makers. Along with composers, architects, and writers, what hackers and painters are trying to do is make good things. They’re not doing research per se, though if in the course of trying to make good things they discover some new technique, so much the better.

At the end of the day, both are craftsman.

I can appreciate this more than most because I actually studied art and computer science in school. Both held great appeal for me and most likely for similar reasons:They both allow you to perform solitary acts of creation.

Software Craftsmanship

In fact, there’s a powerful new movement in software focusing on craftsmanship – they even have their own manifesto:

As aspiring Software Craftsmen we are raising the bar of professional software development by practicing it and helping others learn the craft. Through this work we have come to value:

Not only working software, but also well-crafted software
Not only responding to change, but also steadily adding value
Not only individuals and interactions, but also a community of professionals
Not only customer collaboration, but also productive partnerships

This movement is largely a reaction to offshoring and businesses trying to treat software developers as replaceable cogs. The movement focuses more on individuals and their specific skills. These software craftsmen strive to create not just software that meets spec, but hand-crafted pieces of art.

Seth Godin would be proud.

Posted in Programming.