dimanche 5 juin 2016

The Observer Pattern Explained To Myself

I'm still struggling with the concept of Observer Pattern, so i try to explain it to myself cause i'm not sure I'm right. So perhaps somebody can confirm it's the good approach. For my example i think about a car with 4 seats. When the 4 seats are taken and the car is driving, the car is checking if everybody has got their seat belt on. If not, you hear a sound.

UML Diagram

So i want to observe if the speed is above 10, if the seatbelt is fasten, and if the seat is taken

Is this a good diagram?

Aucun commentaire:

Enregistrer un commentaire