If you work on an application (web/desktop, etc…) where in the program logic do you pull information about the current user? This is a question I have toiled with constantly for a few months now. Being a little bit wishy washy on the subject there are two trains of thoughts here, option A and option B. Option A is pulling the information from the database as soon as the application wakes up. Option B is pulling pieces of the current user as necessary. Option A has the following benefits. All information can be pulled at once and in one location in the code. This means that if you were to check the data in the registry/view it would already be set as a mechanism in your plug-in or bootstrapping process would have loaded it for you. However if you have made changes to the user after this loading period then you would incur another loading period as the data would be stale. If this was a website you could quite possibly get away with displaying stale data at first and then modifiers update the presentation layer via ajax. Option B involves you loading only what is necessary where you need it (other than in the view if you are in the MVC state of mind). For example in one part of your controller you need the users user name and email address, then a few lines down you need their data of birth and the time that their profile was modified. Each query would load only what is necessary at that time. This presents a problem though you have fragmented and small queries in addition to having more queries than Option A. However this presents you with fresh data in every instant as you are pulling it as close to presentation as possible. I am on the fence about both methods but did some brain storming on paper and created a few scribbles.
Both options are viable but it depends on the situation.
