I want to start a project in JEE and I need to confirm about my class diagram. I need to know if the methods used are correct and if the composition I used is correct or not.
This is my class diagram:
The project is about an online sales store, that wants to set up a management tool to sell products, and to manage its products. This tool must include the following features:
Functional Specifications
It is necessary to act on the application, to connect to the application with a user ID and password. To facilitate its use and in order to avoid any mishandling thereafter, here is the solution:
User Profile:
Manager profile:
The manager will be able to manage the products:
These data insertions can be made using CSV or XML files, but also through various forms on the website.
The manager will be able to view the sales statistics.
Supervisor Profile:
Well I wish to know already if you have remarks about my design. As well as I have a confusion for several methods, for example adding, modifying and deleting a product. Should I put them in the manager or product class? Is the composition I put correct or should I remove it?
First some minor remarks about class naming: Ordered
should be called Order
.
The composition between Article
and Order
is just wrong (not from a formal view, but from the meaning it conveys). Use a normal one-to-many association: it would reflect much better the real nature of the relation between the two classes. Please take into account that a new article may exist without having been ordered, so it shoud be 0..*
instead of 1..*
+belongs
and +do
in the middle of an association are syntactically incorect. You should use a plain triangle instead (or nothing at all). The triangle should be oriented in the reading direction Person do |> Order
and Article belongs to |> Category
The methods seem ok. You do not need to add a suffix.
A more advanced concern is not about the diagram but about how you want to organise persistence (i.e. database storage):
But this is a broader architectural question. If it's just for a first experimental project with JEE, you can very well use the active records. It's simpler to set up. Be sure however in this case to disambiguate the Add/Update/Delete on Person
, since it currently may give the impression that any person can add anyone.
A final remark, again not about the diagram itself, is about the domain. Your model considers that an Order
is about a single Article
.
In reality however, orders are in general about one or several articles: if this would also be the case here, your Order
would become an OrderItem
and the real Order
would be inserted between Person
and OrderItem
. You could then make the relation between Order
and OrderItem
a composition (i.e: OrderItem
is owned by Order
, which has responsibility for creating its items, and the items have no sense without the related order).