Hi everyone,
I'm fairly well versed with OOP concepts and am now trying as much as possible to apply it when I design web-apps.
Problem I am facing though is scalability and performance. I don't know which way to go...
Should I be making very simple, almost trivial object to perform basic task (which really add more complexity than anything) or full blown object.
Perhaps what I am asking would be more clear with an example.
Say a Customer object's instance
Customer have a collection of Address.
Now my application needs to display the first/last name of someone.
So some pseudo would look like this
person1 = new Customer(10340);
output(person1.getFirstName() + " " + person1.getLastName());
My issue is with the constructor, have called Customer() I would have loaded the address collection as well which isn't required in most cases.
What am I suppose to do in those case? Break down the "Customer" object? To me having real object simply doesn't scale well, I always end up fetching additional data which I don't need most of the time for trivial tasks.
Suggestions/Ideas??
I'm fairly well versed with OOP concepts and am now trying as much as possible to apply it when I design web-apps.
Problem I am facing though is scalability and performance. I don't know which way to go...
Should I be making very simple, almost trivial object to perform basic task (which really add more complexity than anything) or full blown object.
Perhaps what I am asking would be more clear with an example.
Say a Customer object's instance
Customer have a collection of Address.
Now my application needs to display the first/last name of someone.
So some pseudo would look like this
person1 = new Customer(10340);
output(person1.getFirstName() + " " + person1.getLastName());
My issue is with the constructor, have called Customer() I would have loaded the address collection as well which isn't required in most cases.
What am I suppose to do in those case? Break down the "Customer" object? To me having real object simply doesn't scale well, I always end up fetching additional data which I don't need most of the time for trivial tasks.
Suggestions/Ideas??