Store management system observer pattern RRS feed

  • Question

  • I am willing to take advantage of the Observer pattern in making a retail store management system. I have made a separate library project that has the classes of Store, Product, Vendor, Cart.

    The program should be able to update each vendor account balance when any of his products is added to the cart. The store also must update it's contents , ie the products that are available or those that are now sold out and not show them for the customer. The cart itself must update it's value upon the addition or removal of products from it while the purchase is still not confirmed ( paid ). The product in turn may be a subject to a price change.

    As I see it, using the Observer pattern is in order in this project, isn't it? Can anyone point me to the starting point from which I can take advantage of the pattern. According to my understanding of the pattern, I made the following designations:

    public class Cart : ObservableCollection<Product> , IObservable<Product>
    public class Store : ObservableCollection<Product>
    public class Vendor : IObserver<Product>

    And the product class is a standard class with product properties...

    ..... Is this the prober implementation of the pattern in my case or I am missing something in the structure? Is there a better way to do the Store management operations than using this pattern?

    Sunday, December 24, 2017 10:10 PM


All replies