• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Bi-directional navigation and circular dependancy  RSS feed

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have this confusion. When objects of two classes A and B can call each other's methods, the relationship is bidirectional, right? Now to implement these A and B classes, A has to know about B and B has to know about A, so compilation is a problem. OK, one can get around compilation problem using reflection.
The real question I have is if circular dependancy is bad and implementing bidirectional relationship requires it, then bidirectional relation is bad? I am sure I am missing something because bi-directional relationship is quite common.

We have a scenario where facade builds the cache (a singleton), and inside those cache building methods there calls to facade to get data.
Is something wrong with this design?
Any help is very much appreciated.
-Roshan
 
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wouldn't say that it's *wrong* per se - just somewhat "smelly".
You might want to take a look at the practice ofDependency Inversion, though...
 
Roshan Lal
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ilja. I too feel it is smelly. Thanks for the URL, I will go there.

Originally posted by Ilja Preuss:
I wouldn't say that it's *wrong* per se - just somewhat "smelly".
You might want to take a look at the practice ofDependency Inversion, though...

 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!