T
thechaosengine
Hi all,
I have a very simple issue that I often come up against. I'm just wondering
what the common consensus is on dealing with it.
I have a Project class, that has amongst other properties, an int representing
a ProjectManager. The question is what should I do when I want more details
on the project manager?
I have a couple of options:
I could add extra properties to the Project class so that as well as offering
an id, I can also get the project managers name and email perhaps.
Or, I can take that I'd at runtime and submit another seperate query to get
details on the project manager.
The pro of adding extra properties is that it is much easier to do a common
operation and doesnt require another sql query to be executed because I'd
just get the projman's details when getting the Projects details.
The disadvantage of this is that it breaks encapsulation. Purists believe
that the project managers details should only be contained in a ProjectManager
object.
I'm sure you've all come accross this scenario so I'm just wondering what
everyone else does.
Many thanks to anyone who can advise.
Kindest Regards
tce
I have a very simple issue that I often come up against. I'm just wondering
what the common consensus is on dealing with it.
I have a Project class, that has amongst other properties, an int representing
a ProjectManager. The question is what should I do when I want more details
on the project manager?
I have a couple of options:
I could add extra properties to the Project class so that as well as offering
an id, I can also get the project managers name and email perhaps.
Or, I can take that I'd at runtime and submit another seperate query to get
details on the project manager.
The pro of adding extra properties is that it is much easier to do a common
operation and doesnt require another sql query to be executed because I'd
just get the projman's details when getting the Projects details.
The disadvantage of this is that it breaks encapsulation. Purists believe
that the project managers details should only be contained in a ProjectManager
object.
I'm sure you've all come accross this scenario so I'm just wondering what
everyone else does.
Many thanks to anyone who can advise.
Kindest Regards
tce