I'm building an application with several Connector
classes that interface with varied data silos. For an example, see an earlier question of mine here. Anyways, as is the case in my example, almost all of these data sources are expensive time-wise on access, so each Connector
maintains a cache to limit accesses. For every data silo, there is an IDataSource
that fetches data, and a Connector
that caches. The Connector
is accessed by passing in an IDataSource
to a factory method on my AppFactory
class.
Unfortunately, there is exactly 1 Connector
that does not fit this model. The Active Directory silo is fast enough to not need a cache, so there is no need for an ActiveDirectoryConnector
, nor would there be a factory method on my AppFactory
class. As I said before, in EVERY other case, data is requested from a Connector
object, which can only be gotten from a method call to the AppFactory
with an IDataSource
parameter.
As far as I can tell, my options are to have a shallow ActiveDirectoryConnector
object that just forwards requests straight to its IActiveDirectoryDataSource
, or to not have an ActiveDirectoryConnector
at all. In the former case, I maintain conceptual integrity with the rest of my Connector
s, but I have a useless level of indirection. In the latter, I sacrifice conceptual integrity for directness. Which is the lesser evil?