ifacethoughts

Strings Or Numbers?

Bill Venners comments on David Heinemeier Hansson’s justification for using integers in URLs instead of semantic strings in Ruby On Rails. As an example, if you look at the URL of the Help of this blog, it is http://ifacethoughts.net/help. As against this, using integers would give you http://ifacethoughts.net/564 where 564 is the database ID of the page for help.

Database IDs are created solely for the software, and the user has nothing to do with it. The software use the ID to uniquely identify an entity within its scope. The database IDs usually map onto to a real world identity, like name. David fears that the real world identities might change and hence including them in the URL would make the URL vulnerable to changes, which definitely is a bad thing.

However, Bill provides a solution of using a permanent redirect using the 301 status code. In fact that is the reason 301 was provided. But like Bill says, it might involve more effort on part of the developer of dynamic systems.

I always consider that every element of the interface, not only GUI, should speak the user’s language. Exposing the implementation is a risk, which can cause problems if the implementation changes. I lean towards using strings as they can be intuitive for the user. Using database IDs is too tied to the implementation and maybe easier from the developer’s perspective. But using strings can make it easier for the user, which is what I think software should aim for.

Say your thought!

If you want to use HTML you can use these tags: <a>, <em>, <strong>, <abbr>, <code>, <blockquote>. Closing the tags will be appreciated as this site uses valid XHTML.

freshthoughts

contactme

Abhijit Nadgouda
iface Consulting
India
+91 9819820312
My bookmarks

badgesand...

This is the weblog of Abhijit Nadgouda where he writes down his thoughts on software development and related topics. You are invited to subscribe to the feed to stay updated or check out more subscription options. Or you can choose to browse by one of the topics.