Skip to main content
Inspiring
October 9, 2013
Question

Creating an Object vs simply storing variables

  • October 9, 2013
  • 0 replies
  • 459 views

Are there any pro/cons I should be aware of in this case?

My application has users.  I could create a 'user' object with the appropriate properties and methods to hold the logged in user's information, performing things like: user.getName() and user.logout().   But on the other side of the coin, if I wanted to get the name of a user, I could simply have a structure like SESSION.user.name and just retrieve it's value.  And if I wanted to perform a logout, I could simply call the function in my security component and pass the needed info.

I like the idea of using OOP where possible, but is there any issue with going that route vs more simplified non-OOP methodologies?

    This topic has been closed for replies.