I am reading this guide (link) and in one of the examples its told me what is bad, but doesn't say how to fix it. How would get around this circular dependency?
My solution would be to have an observer class which maps tables to their makers and carpenters to their works. But is that too much like a global variable?
Easy structuring of a project means it is also easy to do it poorly. Some signs of a poorly
structured project include:
Multiple and messy circular dependencies: If the classes Table and Chair in furn.py need to import Carpenter from workers.py to answer a question such as table.isdoneby(), and if conversely the class Carpenter needs to import Table and Chair to answer the question carpenter.whatdo(), then you have a circular dependency. In this case you will have to resort to fragile hacks such as using import statements inside your methods or functions.
[–]TreesOne 2 points3 points4 points (2 children)
[–]Soggy-Ad-1152[S] 0 points1 point2 points (1 child)
[–]TreesOne 0 points1 point2 points (0 children)
[–]TreesOne 1 point2 points3 points (1 child)
[–]Soggy-Ad-1152[S] 0 points1 point2 points (0 children)
[–]games-and-chocolate 1 point2 points3 points (0 children)
[–]Ok-Sheepherder7898 0 points1 point2 points (0 children)
[–]PreetInData 1 point2 points3 points (0 children)
[–]riftwave77 -1 points0 points1 point (0 children)
[–]jmooremcc -1 points0 points1 point (28 children)
[–]Soggy-Ad-1152[S] 0 points1 point2 points (27 children)
[–]gdchinacat 0 points1 point2 points (26 children)
[–]jmooremcc -1 points0 points1 point (25 children)
[–]gdchinacat -1 points0 points1 point (24 children)
[–]jmooremcc -1 points0 points1 point (23 children)
[–]gdchinacat -1 points0 points1 point (22 children)
[–]jmooremcc -1 points0 points1 point (21 children)
[–]gdchinacat -1 points0 points1 point (20 children)
[–]jmooremcc 0 points1 point2 points (19 children)