473,396 Members | 2,030 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Circular Class Library Dependency

Hi,

How can I make two libraries with referencing each other ?
---------
Thanks,
Rafael Pivato
Nov 20 '05 #1
2 1490
Rafael,
The short answer is you cannot.

The long answer is use a Separated Interface Pattern:

http://www.martinfowler.com/eaaCatal...Interface.html

The first project defines a class and an interface that the class expects a
different class to implement. In the second project define a class that
implements the interface.

' Project 1

Public Interface INeedThis
Sub DoSomeWork()
End Interface

Public Class Class1

Public Sub DoSomething(ByVal needThis As INeedThis)
needThis.DoSomeWork()
End Sub

End Class

' Project 2
' references project 1

Public Class NeedThis
Implements INeedThis

Public Sub DoSomeWork() Implements INeedThis.DoSomeWork
End Sub

End Class

Notice that Project 2 references Project 1, but Project 1 does not reference
Project 2. If you want you can put the interface in its own project if you
have a number of interfaces.

Project 1 will need to be a class library. Project 2 can be a class library
or an Application.

Hope this helps
Jay
"Rafael Pivato" <rp*****@cpovo.net> wrote in message
news:uH**************@tk2msftngp13.phx.gbl...
Hi,

How can I make two libraries with referencing each other ?
---------
Thanks,
Rafael Pivato

Nov 20 '05 #2
"Rafael Pivato" <rp*****@cpovo.net> schrieb
How can I make two libraries with referencing each other ?


You can't. When you develop library 1 it needs to reference library 2, so
library 2 must be developed first. You can't develop library 2 first because
it needs to reference library 1.

You may consider a redesign by introducing a lower (common) layer referenced
by both libraries.
--
Armin

http://learn.to/quote
http://www.plig.net/nnq/nquote.html

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Henry Miller | last post by:
I have the following code (much simplified for this post). Note that SessionKey uses DataAccess, and DataAccess requires SessionKey in it's constructor. Public Class SessionKey Public...
2
by: ernesto basc?n pantoja | last post by:
Hi everybody: I'm implementing a general C++ framework and I have a basic question about circular dependencies: I am creating a base class Object, my Object class has a method defined as:...
4
by: ro86 | last post by:
Hello everyone! I am a newbie to C++ (~1 Week experience) and I have a few months of experience with object-oriented languages (Objective-C). I am currently working just for fun on a particle...
4
by: Henke | last post by:
I have this scenario. public class A { public int numbers; public class A() { }
1
by: Rimma Meital via .NET 247 | last post by:
(Type your message here) -------------------------------- From: Rimma Meital I have 2 DLLs (Class Libraries). Both defines single-ton objects - logger object (writes to logger) and...
3
by: Solution Seeker | last post by:
Hi All, I am here with a Query and need a Solution for it. The Query is as Follows, We have 3 Projects in a Solution - Say UI, CMN and PRD First One Deals with UI Forms Second One Deals...
3
by: Rob Clark | last post by:
Hi, I have an issue which is the ordinary and always recurring circular dependency - but I do not know how to resolve it :-( The usual forward declaration does not help... I have a client...
7
by: barias | last post by:
Although circular dependencies are something developers should normally avoid, unfortunately they are very easy to create accidentally between classes in a VS project (i.e. circular compile-time...
8
by: nyhetsgrupper | last post by:
I have written a windows service and want to expose a web based user interface for this service. I then wrote a class library containing a ..net remoting server. The class library have a method...
5
by: fomas87 | last post by:
Hi guys, I'm writing a framework for an sdl gui in c++, but got stuck on the circular dependency, I've read a lot of articles about resolving dependencies and about forward declaration but none of...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.