The Product Class

Now that you have customers, it would be nice if they could buy something. For that, you need the products. Again, the Books for Geeks folks have no doubt supplied you with the product data: title, author(s), ISBN, price, and descriptive text. But there is also hierarchical information in the form of categories that you need to model. This is shown in Figure 5.5.

Figure 5.5. Products and categories.

One question that the client has not yet been asked and that now needs to be posed is this: Can a product live in more than one category? The answer, in this case, is yes. For example, a book like this that deals with Java, Web sites, ...

Get MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.