I'm writing some Java code for an university exam and the project is based on an "e-commerce". One of the requirements is to insert the products in the shopping cart and I've to use the Visitor
pattern.
This is an example that the professor gave me, and I've to "use" it to represent my shopping cart. The problem is that I've a Product
class which contain an istance of the Category
class and products list or categories list are stored in the database (I access to them via query at each step).
Now, first of all ... book
is a category or a product? It could be compared to smartphone or to htc one m8, for example? Also, I've a class that contains all the code "used" by the client. There, I don't have any ShoppingCart object but a simple ArrayList of Products
related to the user.
How can I implement this pattern in my project? Which is the way?
Thank you in advance.
Aucun commentaire:
Enregistrer un commentaire