Are circular dependencies considered bad design?

老子叫甜甜 提交于 2019-11-29 04:39:20

Here is my take:

  • If the two classes belong to the same logical module, then it's probably fine (still a judgement call of course, with lots of grey areas).
  • It's less fine if the two classes belong to different modules. This creates a circular dependency between modules. I try to avoid that as much as can, preferring a clear hierarchical structure.

Yes , It's bad design , It's contradicting the oop principles , It's seems you have to create a new class or interface will contain the the shared parameters and function for a and b , a and b imports this new class...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!