G
Guest
I'm working on a rewrite of our employee database. I plan to implement a
fairly heavyweight base class, which includes 20 or 30 fields, including
address and phone number collections and the like. (I'll use lazy init to
fill the collections when needed.) More specialized employee types would
inherit from the base class.
Sometimes, though, all I need is the employee name and ID number - for
example, when filling a DDL - and I hate to have all the overhead of creating
a heavyweight class object every time I want to look up an employee name by
ID. My question is: what's the best practice for doing very small lookups
like this? Should I create a small helper class, or use a lookup method in
the full class and just live with the overhead?
Along the same lines, I want to have an overloaded method that returns
various lists of employees (by role, active/inactive, etc). Do most people
feel that it breaks abstraction to have a method that returns multiple rows
in an object that represents a single entity? If so, where would a method
such as this live in the object hierarchy? I don't want to have to create
several classes for each separate type of object, but I want to do this the
right way.
Any thoughts would be appreciated..
fairly heavyweight base class, which includes 20 or 30 fields, including
address and phone number collections and the like. (I'll use lazy init to
fill the collections when needed.) More specialized employee types would
inherit from the base class.
Sometimes, though, all I need is the employee name and ID number - for
example, when filling a DDL - and I hate to have all the overhead of creating
a heavyweight class object every time I want to look up an employee name by
ID. My question is: what's the best practice for doing very small lookups
like this? Should I create a small helper class, or use a lookup method in
the full class and just live with the overhead?
Along the same lines, I want to have an overloaded method that returns
various lists of employees (by role, active/inactive, etc). Do most people
feel that it breaks abstraction to have a method that returns multiple rows
in an object that represents a single entity? If so, where would a method
such as this live in the object hierarchy? I don't want to have to create
several classes for each separate type of object, but I want to do this the
right way.
Any thoughts would be appreciated..