Re: Circular references ?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Dave S (dave_xxx70_at_hotmail.com)
Date: 04/07/04


Date: Wed, 07 Apr 2004 22:56:05 GMT

Jason,

Not sure I understand that one but I can try and look into raising events.
Any code examples of this anywhere ?

Thanks
Dave

"Jason Sobell" <iGadget_@hotmail.com> wrote in message
news:70ds7tcggrn2.1cfdlkstq2s0j.dlg@40tude.net...
> You can't directly call from B to A, but you can pass back events with the
> package as a parameter, and this is the standard approach to your original
> problem.
> MyHandler simply raises the event without requiring intimate knowledge
> (i.e. dependency) on project B.
>
> This is not a VB.Net specific issue. It applies to all OO languages. Java
> uses interfaces or events to avoid the issue, and you can do the same in
> VB.
>
> Cheers,
> Jason
>
> On Wed, 07 Apr 2004 22:09:35 GMT, Dave S wrote:
> > Erik,
> >
> > Thanks for this, I just wanted to confirm that it's not possible to do
it
> > with just 2 projects.
> > I tried moving my object into another project (so it's sort of an
interface
> > project) and then each of the other projects can reference that project
> > without causing the circular reference problem.
> > I just thought it was a bit messy when in Java you could easily do this
> > without a middleman package containing the object you want to pass
between
> > the classes.
> > At least I know that it wasn't something I'd missed out when declaring
the 2
> > projects initially.
> > Will have to remember this one in future (I've been struggling with this
all
> > afternoon)
> >
> > Dave
> >
> >
> >
> >
> > "Erik Frey" <eriksjunk@hotmail.com> wrote in message
> > news:uCVltrOHEHA.3556@TK2MSFTNGP10.phx.gbl...
> >> "Dave S" <dave_xxx70@hotmail.com> wrote in message
> >> news:ac629e82aab3c366fe2c0c20e78b5eee@news.teranews.com...
> >>> Anyone know how to get round the problem of circular references in
> > VB.NET
> >>> (sorry I'm a .NET newbie).
> >>> I create one project which has 2 classes in it, MyHandler and
MyObject.
> >>> MyHandler just needs to call another class in a different project and
> > pass
> >> a
> >>> parameter of type MyObject to it.
> >>> So the class in the different project needs to import the first
project
> >>> namespace so it know what MyObject is.
> >>> The MyHandler class needs to import the second project namespace so it
> > can
> >>> call the class in the second project.
> >>
> >> Typically this is adressed by creating a third project that contains
your
> >> business types in it.
> >>
> >> Then have your other two projects refer to this new project, to have
> > access
> >> to the common type (so in your case, put MyObject in the third
project).
> >>
> >> Also, keep in mind that even if you have three projects in a solution,
you
> >> still have to add the project references manually (right click on
> >> References - > Add References -> Projects tab)
> >>
> >> Erik
> >>
> >>



Relevant Pages

  • Re: dynamic type checking - a pauline conversion?
    ... to actually write the code in Java. ... Is the query handled ... One of the problems with Java typing is small differences in interfaces ... array iteration, List iteration, and database query result iteration all ...
    (comp.object)
  • Re: CLOS Properties Question
    ... In interfaces, you can declare methods, but you ... This mess was the result of the fact that interfaces ... > is even an OOPSLA or ECOOP paper published before the advent of Java ... > Back to the question what this all has to do with multiple inheritance: ...
    (comp.lang.lisp)
  • Re: Python vs C for a mail server
    ... that is mostly unnecessary with Python. ... > I don't have enough experience with languages that provide interfaces, ... > such as Java, to understand how useful they are, but it's my impression ... I can't comment on "most Java APIs", but if you look at established ...
    (comp.lang.python)
  • Re: MRO theory
    ... It creates a Python class to proxy any Java class or Java ... Java proxies go, when it creates a class it can have at most one ... The problem basically comes about because interfaces are not classes, ...
    (comp.lang.python)
  • Re: Java "interface" vs. OO interface
    ... > I think Java uses interfaces instead of classes because the designers ... To think that the designers of Java and .NET couldn't figure out a good ... Enough for a language to adopt a new keyword ...
    (comp.object)