I have a little architecture issue.
On my site user can register and when they log in on site based on userID I redirect user to his profile page (something like facebook).
User can from this page click on another user from list and go to his profile page.
When user come on his friend profile page he can access to some links on that page to see more information on this friend (like his friends list, images, info etc.).
So what I am doing now is when user click on his friend I save friendID in Session.
And later when I need access something I first get data from session and go.
I wonder is this approach good or bad?
It works but I wonder is there better approach?
I have a little architecture issue. On my site user can register and when
Share
IMHO, it’s not a good design. This is like using a global variable to reference the “current friend”. Obviously, this makes it impossible to view information about two different friends at once, by opening the “friend info” page in another browser tab or window, for example.
It also couples the “friend info” page to the “friend list” page. This means that any other page which wants to link to the friend info page must put the friend ID in the session, and that you’re forced to go through one of these pages to see a friend info. If the user bookmarks the friend info page, closes his session, reopens one, and uses his bookmark, it will fail.
And finally, it makes the application stateful, whereas it could stay stateless by having the “friend list” page simply link to the “friend info” page by using a link such as
friendInfo?friendId=<the friend ID>.