Example:
class Car {
Car[] otherCars;
MsgHandler listeningThread;
}
class MsgHandler{
Thread t;
}
The idea its that the MsgHandler when receiving a message, if its matches certain criteria, it has to update the otherCars attribute of the Car object who belongs to. Im considering many alternatives to design this, but im not sure which its cleaner or more elegant:
- Observer Pattern
- Simply passing the attribute to modify as reference
- Put all the logic on the main class
Im looking for something that can scale to a more complex logic and more attributes involved.
Aucun commentaire:
Enregistrer un commentaire