design question( the app is written in c# ;) )

  • Thread starter Thread starter parez
  • Start date Start date
P

parez

Layer A is on top on Layer B.
Layer A talks to layer B using the interfaces defined in B. For input
and return values.



My question is should i take out the interfaces from B and put it in a
separate project?
 
The extraction of interfaces is most useful if you are going to create a
completely different layer B for other applications. If you are simply going
to version with additional "providers", you can do that in the same library.
It really depends on where you are going with this one.

One time it is a great idea to move out into its own library is a case where
you have multiple clients who each need a slightly different version of the
library, but do not want to ship other client's implementations with the
library. You will generally go to a config driven provider model in this
case, however, so you can test multiple implementations with simple
configuration changes.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
 
The extraction of interfaces is most useful if you are going to create a
completely different layer B for other applications. If you are simply going
to version with additional "providers", you can do that in the same library.
It really depends on where you are going with this one.

One time it is a great idea to move out into its own library is a case where
you have multiple clients who each need a slightly different version of the
library, but do not want to ship other client's implementations with the
library. You will generally go to a config driven provider model in this
case, however, so you can test multiple implementations with simple
configuration changes.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|

I am trying to make component B resusable and also replaceable if need
be.

1)If I use interfaces defined in B then it will make it resusable.
2)If i separate the interfaces in to a different project then it will
make B replacable by a component C which uses the same interafaces..


Correct me if i am wrong.

so 2 should be the way to go.
 
If you want to replace a complete component, then separation will work well.
If you can put things together in a single library, then it need not be (ie,
add classes). Plug and play is certainly easier if interafaces are in a
different project. For deploying, you might still wish to compile the
interface assembly into the other assembly when you get close to deploying.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
 
parez said:
I am trying to make component B resusable and also replaceable if need
be.

1)If I use interfaces defined in B then it will make it resusable.
2)If i separate the interfaces in to a different project then it will
make B replacable by a component C which uses the same interafaces..

Correct me if i am wrong.

so 2 should be the way to go.

If you make it the right way then it should not matter much !

The right way means that only the API (interface, factory, pure
data classes) are public and the rest is internal.

Explanation:

public API + internal impl in B

you want a different implementation

public API in B + internal impl #1 + internal impl #2 in B

or

public API in B
public impl #1 in C1
public impl #2 in C2

is invisible to A.

The important aspect is to ensure that A does not use any implementation
specific features.

Arne
 
Back
Top