Java Class Question - class diagrams also

Hi,

Very new to Java; lol stating the obvious. I know some java but one problem i have is knowing how to create properly a real life project.

Taking for example a video shop. It has a class for members, products - dvds, games, (which inherit from products). However, if i'm not mistaken, isn't it a many to many relationship between produts and members?

Therefore, this would go into another class; ok the question.

Would the relationship here be required in a complete class of it's own or would it be in the class that creates the GUI etc?

I'm learning by myself, in my own time, so please no sarcastic comments.

Message was edited by:

snipered2003

[705 byte] By [snipered2003a] at [2007-11-27 7:36:28]
# 1

Before getting into Java or GUI issues, le'ts think about modeling, itself.

There is a many-to-many relationship between Product and Member. A member can rent many products, and a product can be rented by many members, over time.

Often, but not always, with a many-to-many relationship, additional attributes arise. In this example, you will want to know the date the product was rented, the due date, the actual return date, etc.. This information could be gathered into a Rental object, which references Member and Product. In this way, a many-to-many relationship often turns into a pair of many-to-one relationships.

Hippolytea at 2007-7-12 19:16:59 > top of Java-index,Java Essentials,New To Java...
# 2
Hi, thanks for the response.So you meanMemberrents (rent date, return date) -- product with subclasses.So would i implement a gui form in a completly seperate class and instantiate the other classes from that class?
snipered2003a at 2007-7-12 19:16:59 > top of Java-index,Java Essentials,New To Java...
# 3

> So would i implement a gui form in a completly seperate class and instantiate the other classes from that class?

Notice how I avoided talking about the presentation (GUI) layer? That's because the business logic layer should be independent of the presentation layer. Worry about the business objects first.

Hippolytea at 2007-7-12 19:16:59 > top of Java-index,Java Essentials,New To Java...