samedi 21 novembre 2015

Communicating to an Object from another without coupling in java?

So i have a Person object, and a GumballMachine object. the behavior i'm searching for is, in the intent to avoid unnecessary coupling, have the method "insertCoin()" called from within the person object, which will then call the "insertCoin()" within the GumballMachine to receive a Gumball. What's a proper design-pattern, or solution that avoids coupling, and keeps these two objects as oblivious to each other as possible while having a type of "Bridge" between them?

Aucun commentaire:

Enregistrer un commentaire