Object factory and interface class

G

guhar1

A few design issues:
1. If I decide to implement an interface between my "business object
layer" and my "data access layer", so as to protect the BOL from
changes in DAL, do I provide ONE interface class containing all the
other required interface, or do I expose several separate interface to
the DAL? (Seems conceptualy cleaner to provide on interface class, and
stuff everything I need in it)

2. I i decide to provide an "object factory", so as to create my object
on the fly using a config file (Oracle vs SqlServer) should the factory
be encapsulated in the interface, or should it be at the same level as
the interface (BOL-DAl), or shoud it be global to all layers?

Thanks
 
C

C.C. \(aka Me\)

It may depend on what type of things the DAL does.

For instance if the DAL had the following things that it handled:

DB access
Email access
Logging

Then you may want to have several interfaces (one for each group) that way
they could be reused by other layers in pieces instead of the whole thing.
Chances are, also, that your DAL will not be in one specific class - you
will probably have several classes that make up your DAL. If that is the
case then having a single interface for each class would make more sense
also.

If you only have a few methods to your DAL (maybe just DB access) then
having 1 interface that contains all the methods would be fine.

If there are 20+ methods that make up your DAL then having 1 interface may
not be the best solution.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top