M
^MisterJingo^
Hi all,
I have question regarding good practice. In the business layer I have
created, one object represents one part of the system. For example, if
I am manipulating clients, an instance of a 'client class' is
created. Sometimes I need to manipulate all clients in the database.
Would it be bad practice to create a method in client class which
allows the manipulation of all clients? For example, I have a page
which lists clients. To do this I have a method of client which returns
a dataset of all clients. So this method of a single instance of client
can provide data on all clients. To do this, client class can be
instantiated with a specific client Id (when working with a specific
client), or an 'empty' client object can be created to allow access
to all its methods which deal with all clients. I have to instantiate
the client class as the system uses an encapsulated database object
which is passed into each created object (and deals with all DB
connectivity).
Should I have separate objects to deal with single and all clients? Or
is this method acceptable?
Any opinions would be appreciated.
I have question regarding good practice. In the business layer I have
created, one object represents one part of the system. For example, if
I am manipulating clients, an instance of a 'client class' is
created. Sometimes I need to manipulate all clients in the database.
Would it be bad practice to create a method in client class which
allows the manipulation of all clients? For example, I have a page
which lists clients. To do this I have a method of client which returns
a dataset of all clients. So this method of a single instance of client
can provide data on all clients. To do this, client class can be
instantiated with a specific client Id (when working with a specific
client), or an 'empty' client object can be created to allow access
to all its methods which deal with all clients. I have to instantiate
the client class as the system uses an encapsulated database object
which is passed into each created object (and deals with all DB
connectivity).
Should I have separate objects to deal with single and all clients? Or
is this method acceptable?
Any opinions would be appreciated.