Routing and State (The AngularJS Discussions)

I’m a big fan of the Adventures in Angular podcasts.  At a recent podcast that happened at ng-conf in Salt Lake City, there was a lively discussion around the topic of routing and URL’s.  Specifically, one side of the discussion was that a URL defines a state of an application.  The other side said that is not true.

Personally, I think it’s ridiculous to think that a URL can define that state of applications.  My first proof is that there is a huge amount of discussion around it.  If it was clear and true, there would not need to be discussions about it.

I believe that URL’s are simply pointers to places in web sites.  That’s it.  Any more than will breed confusion.  The most trivial example is that a web page is different when the user is authenticated (logged in) versus not.  That by itself should close the discussion.

On a more constructive note, I think it’s reasonable to map application states to URLs. For Example, their might be three states while viewing an employee record on a web site, all at the same URL. The states might be as follows:

  • State 1:  Not Logged In (show error)
  • State 2: Logged in as Employee
  • State 3: Logged in as Manager

All three states would show different data and allow for different interactions.  All different, all on the same URL.

Bottom line, we as engineers should not get confused with things we do for convenience and start thinking that there is some science behind that.  Recognize it for what it is.

About Peter Kellner

Peter is a software professional specializing in mobile and web technologies. He has also been a Microsoft MVP since 2007. In addition, he's a multi-course video author at Pluralsight. To read more about Peter Kellner and his experience click here. For information about how Peter Kellner might be able to help you with your project click here.

Follow me:


Trackbacks

  1. […] Routing and State (The AngularJS Discussions) (Peter Kellner) […]

Follow

Get every new post delivered to your Inbox

Join other followers: