I can not find anywhere else where I can show an OO system design and get feedback on it.
Could you identify major problems with my design and how to solve them?
The description of the problem is as follows:
- Create a class diagram of a restaurant system. There are employees and they can play multiple roles, depending on demand. Example: An employee can be a cook at a time and a waiter at another time.
- The owner of the store must be able to access the system and say: that day, I need 3 cooks, 5 servers, 2 managers, etc. from 17h to 20h, then from 20h to 22h. I need 2 cooks, 2 waiters and soon. The user has not specified which employee will be present, only the roles and quantities for the time.
- There is an external system that can, after receiving a set of requests, determine which employees will respond to these requests. How to call this system (what needs to be conveyed to it and what needs to be recovered) must be part of the design.
Here is the class diagram that I have built to meet the requirements:
What can be achieved from this design is:
Employeehave a lot
Roles (requirement 1)
ControllerThe class is the one triggered by the user. On the basis of the entry (that day, these roles and these quantities are needed), he creates a list of
Requestindicates that N number of
Roles required between start date and end date (requirement 2)
Controllercalls the external API (
Planner) passing requests and the list of employees, and the API returns a
Programobject which is a composition of several
Rolefor a given start and end date (requirement 3). Here, it could be a facade to an external system, but it is represented as a class for simplicity.