Re: cyclic dependency



Nicholas,

Yes, I agree, but we are limited to what is giving as other team do not
agree to change anything other than adding one line for our part. Only thing
I wish is that managers would understand more of the programming than
deadlines.

Thanks.




"Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:uSyQ5MFCGHA.2908@xxxxxxxxxxxxxxxxxxxxxxx
> Po,
>
> Forgive me for saying so, but I see cyclical references between
> assemblies as a sign of bad design. If they really have a need to have
> that level of familiarity with each other, then I don't see why they can't
> be in the same assembly.
>
> If you really need this, the only way to do it is the way that Jay
> suggested, using interfaces. Otherwise, you will have to place the
> classes in the same assembly.
>
> On top of that, I don't think that you will find circular references in
> .NET anytime soon. I think it was considered at one point, but shot down
> pretty quickly.
>
> Hope this helps.
>
>
> --
> - Nicholas Paldino [.NET/C# MVP]
> - mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
>
> "Pohihihi" <noemail@xxxxxxxxxxx> wrote in message
> news:O8Tau7DCGHA.336@xxxxxxxxxxxxxxxxxxxxxxx
> This is a report from VSS newsgroup in hope of getting some more
> suggestions.
>
> Thanks,
> Po
>
> -------------------------------------------
> I guess I am not getting the whole picture here. How does this apply to
> the
> condition when there is a cyclic reference for the binaries (dlls) in
> dotNet
> !!
> What I am thinking is that to use the real ProjectB object I will still
> need
> to create a object from ProjectB for mapping in ProjectA, which again puts
> me in loop.
>
> Two interfaces can be made for 2 different project but still for mapping
> unless I use dynamic assmebly invoke I do not see how we can do somethng
> like following ---
>
> // 1st physical binary (MyProject.Home.dll
> namespace MyProject.Home
> {
> public class ProjectA: System.Windows.Forms.Form
> {
> public ProjectA()
> { // create object to use later}
>
> public void MyProjA_Method()
> { // do something }
>
> public void MyProjAMethodCallsProjBMethod()
> {
> int i = (new ProjectB()).CalBalls(5);
> }
> }
> }
>
> //2nd physical binary (MyProject.Work.dll
> namespace MyProject.Work
> {
> public class ProjectB: System.Windows.Forms.Form
> {
> public void MyMethodInB()
> {
> ProjectA pA = new ProjectA();
> pA.Show();
> }
>
> public int CalBalls(int i)
> {// return some calculation as int}
> }
> }
>
>
>
> "Jay B. Harlow [MVP - Outlook]" <Jay_Harlow_MVP@xxxxxxxxxxxxx> wrote in
> message news:uX7Dn%238BGHA.2036@xxxxxxxxxxxxxxxxxxxxxxx
>> Pohihihi,
>> Normally when I have two projects that need to refer to each other I use
>> a
>> Separated Interface Pattern.
>>
>> http://www.martinfowler.com/eaaCatalog/separatedInterface.html
>>
>> Depending on the needs of the solution will decide if I use 2 or 3
>> projects
>> to implement the Separated Interface Pattern.
>>
>> The "easiest" way is to put the interfaces in the first project, then
>> reference the first project from the second. Alternatively you can put
>> the
>> interfaces in a project by themselves, and reference the interface
>> project
>> from both of the other projects.
>>
>> Something like:
>>
>> ' Project A
>>
>> Public Interface InterfaceA
>> Sub SomeMethod()
>> End Interface
>>
>> Public Class Something
>>
>> Sub DoSomething(anA As InterfaceA)
>> anA.SomeMethod()
>> End Sub
>>
>> End Class
>>
>> ' Project B
>> ' references Project A
>>
>> Public Class SomethingElse
>> Implements InterfaceA
>>
>> Sub DoSomething()
>> Dim something As New Something
>> something.DoSomething(Me)
>> End Sub
>>
>> Sub SomeMethod() Implements InterfaceA.SomeMethod
>> ...
>> End Sub
>>
>> End Class
>>
>> --
>> Hope this helps
>> Jay [MVP - Outlook]
>> .NET Application Architect, Enthusiast, & Evangelist
>> T.S. Bradley - http://www.tsbradley.net
>>
>>
>> "Pohihihi" <noemail@xxxxxxxxxxx> wrote in message
>> news:edk95d5BGHA.1544@xxxxxxxxxxxxxxxxxxxxxxx
>> Hello,
>>
>> I have 2 project A & B belonging to same solution. Now what I want is
>> that
>> few forms I am accessing from A in B and few I am doing that other way
>> around. What should I do to not get the error while building solution, I
>> mean by the build sequencing.
>>
>> Thanks,
>> Po
>>
>>
>


.



Relevant Pages

  • misc thing (my lang): vm handling of external objects
    ... it isn't really possible to pass vm references around outside the ... only the direct interface code will know anything about the vm. ... objects are untyped void pointers. ... another in the external codebase) will manage the export of vm references ...
    (comp.lang.misc)
  • Re: cyclic dependency
    ... but I see cyclical references between ... assemblies as a sign of bad design. ... public class ProjectA: System.Windows.Forms.Form ... > to implement the Separated Interface Pattern. ...
    (microsoft.public.dotnet.languages.csharp)
  • Failed to run sample from article Setting Large Data
    ... I wonder how to utilize IRowsetChange interface with Microsoft SQL Server ... const ULONG cBindings = 1; ... // Release any references and return. ...
    (microsoft.public.data.oledb)
  • Re: cyclic dependency
    ... I have to say I don't understand the reasoning behins this circular ... assemblies, which seems reasonable. ... but I see cyclical references between ... to implement the Separated Interface Pattern. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Cross-AppDomain call problems
    ... I have a simple interface assembly that defines all the types the two ... assembly (and possibly all the assemblies that it in turn references) to get ... Make all calls to the other appdomain via ...
    (microsoft.public.dotnet.framework)