Reputation: 2517
I apologize if the title is not clear, I couldn't think of anything else.
So I'm using a simple MVC architecture where I have following packages: controller, bean, dao
One of my bean class is UserDetailsBean
which contains getter and setter methods for lets say 20 types of user details like username, password, address, email, gender, dob etc...
When the user logs in I create an object for UserDetailsBean
and use only two properties setUsername()
and setPassword()
and pass this object to my dao class UserDetailsDAO
for database validation.
My question is that the UserDetailsBean
has many getter and setter methods but I'm utilizing only 2 of them during login, does this affect my performance? What if I create another bean class say UserLoginBean
which has getter and setter for only username and password, does this gives me better performance compared to my previous approach?
PS: By performance I mean any help I can get for a more effective and fast working application.
Upvotes: 0
Views: 68
Reputation: 1250
As per my knowledge and if I am not mistaken in understanding your question,
using less of getter and setter functions do affect your performance because their less usage will lead to less of data movement , so your code's performance will get affected.
Getter and setter methods are not even particularly object oriented (OO).
In fact, they can damage your code's maintainability.Moreover, the
presence of numerous getter and setter methods is a red flag that the program isn't necessarily well designed from an OO perspective.
You'll get even a better idea through this relation that
maintainability is inversely proportionate to the amount of data that moves between objects.
For better understanding that how they'll affect your performance, you can also refer here.
Upvotes: 4