G
Guest
Hi
I feel real silly asking this, I have been posed with a simple design question which goes as follows (I am from a procedural background and not oop which may help explain my stupidity)
I have a class called Person and a class called Developer. Developer Inherits from Person. When I call the GetDeveloper method in the devloper should this return the Developer specific information only or should this also bring back the Person information. By defintion a Developer is a person. I would like to keep the Person data access code encapsulted and there fore does calling the Developer data mean that I would need to make two calls to the database - one that would get the devloper data and a secondary one which would get the person information. I have thought about achieving this with a lazy load style design whereby the class would work so that GetDEveloper returned only the developer specific information and a call to any 'person' related property would retrieve the Person information - preferably I want to acheive this as a single function call. This is a fairly simple example but I feel like I am losing my head.
How would you guys go about doing this
Please help.
I feel real silly asking this, I have been posed with a simple design question which goes as follows (I am from a procedural background and not oop which may help explain my stupidity)
I have a class called Person and a class called Developer. Developer Inherits from Person. When I call the GetDeveloper method in the devloper should this return the Developer specific information only or should this also bring back the Person information. By defintion a Developer is a person. I would like to keep the Person data access code encapsulted and there fore does calling the Developer data mean that I would need to make two calls to the database - one that would get the devloper data and a secondary one which would get the person information. I have thought about achieving this with a lazy load style design whereby the class would work so that GetDEveloper returned only the developer specific information and a call to any 'person' related property would retrieve the Person information - preferably I want to acheive this as a single function call. This is a fairly simple example but I feel like I am losing my head.
How would you guys go about doing this
Please help.