I'm writing an application. I want various parts of it to be accessible via a single string (e.g. a URL). I see lots of different ways to implement this and wonder if anyone else is thinking about it.
For example, let's assume a web app that supports several different message boards. A URL to access the third comment in board A might be http://msg.com/A/3, and we might respond to that message at msg.com/A/3/reply. There should be no state required of a URL - I can go directly to msg.com/B/25/reply to respond to the 25th message of board B.
How would you structure your code to handle this sort of navigation? Let's assume you know how to parse the URL.
Potential problems:
Some interface components don't care where they are, but some need to know. The logoff button can just go to msg.com/logoff without caring where it was clicked. On the other hand, the reply button (or whatever configures the reply button) needs to know which board and message we are reading right now so it can link to the right address.
Ideally, the code will stay separated. This means no global string that all code can access and modify if we can help it. We could use an event bus or injection as preferable alternatives.
I don't know if this even counts as a question around here... I'm just looking for thoughts, really!