S
S
slip312019-05-12 11:37:14
Software design
slip31, 2019-05-12 11:37:14

How to design a check?

Good afternoon.
There are Services provided by Employees. Each employee has access to the provision of this service on the basis of certain documents (say, for electricians this is a permit, for doctors this is a certificate, for a seller this is a medical book). How to design the provision of services with an employee access check? In order not to produce a bunch of if else? I would like to somehow store these specifications separately so that they can be updated. Any class and transactional pattern predicts the possibility of providing a service
. Is it possible to somehow use the Specification pattern?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
ddd329, 2019-05-13
@ddd329

Hey! Well, if the question concerns design, then the concept of Service immediately catches your eye . In the subject area, it is desirable not to use it, because. this term is very overloaded and has many concepts in programming. I saw in one project it was replaced by Product , but okay, that's not the point ...
The "Specification" pattern, I think, is not particularly appropriate here. You can make it so that each Employee contains a field with a list of Documents , and in order to find out whether an employee can provide a service, you can do something like this:
if (employee.СanProvideService(service)) ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question