Am i using interfaces correctly?

G

Guest

I am building a multi project C# program that draws graphic objects.

These objects are created in the business layer, there is also a collection
class that handles adding new objects and pushing changes back to the data
layer. So far so good.

Now I am working on the GUI layer. All my GUI components needed to refer to
the collection, so that they know what to draw.

I am trying to isolate the GUI layer as much as possible, but as I said,
some of the components need to see the collection. There are more than one
component that needs to see the collection, so I thought it would be good to
create a GUI level Singleton object that housed the collection, I describe it
as a "Singleton facade". While I think this correct, I would welcome
comment....

This GUI level singleton object needs to be accessed by each layer (the
buiness and GUI).

In order for the business layer to access the "singleton facade", that layer
needs to reference the facade in the GUI layer. At the same time, the
"singleton facade" needs to know about the graphic objects and their
collection object so that it can deal with these objects.

Entering both of these references, in the IDE, creates a circular reference
error.

So I created interfaces that define the base level objects (collection and
each object in the collection). These interfaces are created in a "Shared"
project which each of the two other projects, the "Singleton Facade" project
and the Business layer project, refer to the shared project to pick up the
interface definitions.

This seems to be working. Am I doing this right?

Has anyone done anything like this?

Thanks,

Bob Maxey
 
K

Kevin Yu [MSFT]

Hi Bob,

If the singleton facade it has to be referenced by all other components.
However, in my point of view, the business logic layer should not reference
the singleton facade, as what business logic deals with has nothing to do
with the GUI. It has to be the singleton facade that references the
business logic. HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

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