I can't find anywhere else where I can show an OO system design and get feedback on it.
Could you identify any major issues with my design and how to fix them?
The description of the problem is as follows:
- Create a class diagram of a restaurant system. There are employees and they can perform many roles, depending on the demand. e.g.: an employee can be a Cook at a time, and a Waiter at some other time.
- The store owner must be able to go to the system and say: on such day, I need 3 cooks, 5 waiters, 2 managers, etc from 5PM to 8PM, and then from 8PM to 10PM I need 2 cooks, 2 waiters, and so on. The user didn't specify which employee will be there, only roles and quantities for time of day.
- There is an external system that can, after receiving a set of demands, decide which employees will fulfill those demands. How to call this system (what to pass to it and what to get back) must be part of the design.
Here's the class diagram I've built to fulfill the requirements:
What can be achieved from this design is:
Roles (requirement 1)
Controllerclass is the one triggered by the user. Based on the input (on such day need these roles and quantities) it creates a list of
Demandindicates that N number of
Roles is required between a start and end date (requirement 2)
Controllercalls the external api (
Scheduler) passing the demands and the list of employees, and the api returns a
Scheduleobject which is a composition of several
Rolefor a given start and end date (requirement 3). Here this could be a Facade to an external system, but it's represented as a class for simplicity.