[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.newcomer] Re: Why are cycles bad?
|
"Hauke Fuhrmann" <haf@xxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:gbr9os$6vg$1@xxxxxxxxxxxxxxxxxxxx
> Hi there,
>
> I create Eclipse plug-in projects and sometimes two projects depend each
> other because each uses classes from the other one. Why is this regarded
> a severe problem? The projects won't be compile with it.
>
> It just says that at runtime both of the cyclic projects are required.
> If both projects were loaded, all classes could be correctly accessed.
> So why would it be a problem at all?
How would you compile the individual projects with javac, if you didn't have
Eclipse? Which project would you compile first, and how would it be able to
resolve the missing types? I think you are asking Eclipse to combine your
projects into one, under the covers. Maybe instead of multiple projects you
want multiple source folders within one project?
But anyway, if these are plug-in projects, then there is also no way to make
the cyclic dependencies work at runtime. Plug-in dependencies are one-way;
if A depends on B, then B cannot depend on A. (Fragments are sometimes a
way around this.)
I wonder if you really need this two-way dependencies, or if you can use the
more typical approach of having plug-in A export some interfaces that
plug-in B implements, and having plug-in B extend extension points that use
those interfaces. In other words, B sees A's classes and can hand A objects
that are implementations of interfaces in A, but A does not see any of B's
classes.