Week of July 28th

I had a lengthy discussion with Chad last Friday and again this Monday regarding using session variables versus using a class to store session data. Chad doesn’t like session variables so he suggested I make a class to store all session data. The upside is that we can now store different data types in the class – session variables are limited to string data. Having never worked with a system that’s supposed to support so many people simultaneously, I started wondering how efficient it was to store so much information in a single class for each user. We created methods that query the database and return data in lists. We don’t have methods that return each individual field in the database, but instead that return chunks of data relevant to what we need. For instance, the getUserInfo method will return fields containing the user’s first name, last name, email, settings, etc. However, I found that I needed specific fields from that method in other parts of the website. The solution was then to either create specific methods that return just the fields that I need, or to populate a UserSession class with all the data I may ever need upon user log in. I went with the latter solution. I don’t know if this is necessarily the most efficient route, so we’ll have to run metrics later on.

Leave a Reply

Your email address will not be published. Required fields are marked *