nus-cs2103-AY2122S1 / forum

18 stars 2 forks source link

If two classes depend on each other, what should we draw? #441

Closed kevinchua6 closed 3 years ago

kevinchua6 commented 3 years ago
class Player {
    doSomething(Status status {
        ...
    }
}

class Status {
    doSomething(Player player {
        ...
    }
}

In the case of something like this, do we draw a double headed dashed line or do we draw a dashed line with no arrowheads? image image

Or do we draw two dashed lines pointing to each other? image

fans2619 commented 3 years ago

Probably both are okay (not the one with no arrow head) but circular dependency is not good.

yucheng11122017 commented 3 years ago

I believe the first one is the best.

damithc commented 3 years ago

This one.

image

Dependency is uni-directional. There are no bi-directional dependency arrows.

kevinchua6 commented 3 years ago

Ok thank you prof!