A company has 3 kinds of employees: Manager, Software Designer, andHardware Engineer. Each employee category has a different PTO (PaidTime Off) scheme. For example, the Software Engineer is part of a Bonus-Holiday scheme wherein his/her PTOs depend on the successfulprojects completed in a month. The CEO of the company wants to findout how many combined PTOs are left at the end of the year, so they can be donated to sick employees in need. Design a software module to calculate this value. The answer to this question is Chain of Responsibility or Decorator pattern. Can anyone explain this?
Asked
Active
Viewed 139 times
-2
-
How do you know the answer is one of those patterns? – jaco0646 Dec 10 '18 at 19:40
2 Answers
0
I don't think this a decorator pattern. Though each employee can be a software engineer and a Manager at the same time, it doesn't mean that his/her PTO should be wrapped twice.

Akshata Dabade
- 477
- 5
- 10
0
This question seems ambiguous. The point mentioned by Akshata Dabade is also important. Even if we remove that ambiguity, it doesn't seem Decorator or COR. Nearest pattern to this is Strategy. COR talks about multiple objects getting opportunity to handle the request in a chain manner and Decorator talks about layered reused objects with inheritance (Both concerns are absent here). Strategy talks about family of (interchangeable) algorithms, which is present.

Kedar Tokekar
- 418
- 3
- 10