lundi 5 octobre 2015

java factory and observer pattern

I have to create a app for school and I have to use both factory pattern and observer pattern. I’m having some difficulty with understanding which one of my files should be the observer and which one should be observable.

I have a class called Shoe, and have concrete classes for different types of shoes and they all extend my Shoe class. I also have a shoeFactory. I have assigned an int for the amount of shoes that should be in store and I have generated random numbers for the amount that there is now. I want the observer to simulate amount of shoes(types) sold over time.

I’m having some difficulty understanding observers and it might be that my logic is incorrect and that observers are not used for this purpose, if that is the case, please let me know because I am completely lost.

Aucun commentaire:

Enregistrer un commentaire