I'm currently creating a class diagram for a takeaway ordering system. The system allows the owner to update customer info, update orders etc. Would I put the method updateCustomerInfo() in the Customer class or the Owner class? since it's the owner doing the updating - not the customer
Asked
Active
Viewed 663 times
1
-
Is your owner an actor of a use case ? Or is it really a class that you need in your model (gui class or whatever) ? – Christophe Apr 06 '16 at 19:37
-
The owner's an actor in a use case. I'd made an owner class because there's also other staff who can use the system but can't do everything the owner can do. Wasn't sure how to show who can use which methods in the class diagram. Do you think i'd be better taking the owner class out? – molly Apr 06 '16 at 19:42
-
Your title is wrong. You don't put methods in diagrams at all. Methods appear in compartments of classes and aas messages in SDs. – qwerty_so Apr 06 '16 at 21:00
1 Answers
0
If you have classes such as Customer
, Order
, OrderItem
, you need to hide the internals of these classes. So you'd use an update()
method in each of these classes and make available for the rest of the world to update the objects.
There's no unique answer for second part of the question. It depends very much on the focus of your model: is it a domain model ? Or a design model ?.
- In a domain model you wouldn't include actors in your class diagram, unless it's strictly necessary (for example to keep track of an audit trail which references the user who created/modified an object)
- In a more detailed design, it could make sense to model the the user account management classes needed by your system, or the user interface class model. In the latter case, operations that can be performed via the user interface would be represented using classes for a Command design pattern, or methods in an application menu or a proxy GUI objects referring to your domain objects.

Community
- 1
- 1

Christophe
- 68,716
- 7
- 72
- 138