K
K
Kirill Gorelov2020-10-01 10:27:59
PHP
Kirill Gorelov, 2020-10-01 10:27:59

How to program business processes?

For a very long time I was worried about the question of "programming business processes".
How to properly approach this issue ...... The

irony of fate.
I have faced this problem in practice.
It was necessary to program the BP:
There is a project that gets approved by the main department, which sends this project to additional services (5 pieces). Each service exposes the status (approved, for revision, refuse). Also, the project should have logs. Who and when put what status to the project. And leave comments on the project.
Also, after all the services have set their statuses, the project must return back to the main unit. And then the fate of the project is being decided. And the important point is that this PSU can be looped indefinitely.
As a result, the project is either approved, or sent for revision to the author, or sent back to the services (that is, the looping of the process).

I did everything, but I did not like my implementation. Because I have a lot of conditions for status checks and looping ....

I understand that there are design patterns, but I did not find the use of these patterns for this task .... Most likely due to lack of experience in programming the PSUs themselves. Therefore, apart from the conditions, I did not succeed. And all these conditions were programmed inside the controller.

In my opinion, I am already working on the bugs, either it was necessary to use some kind of behavioral pattern, or to put all these conditions into a separate class or component.

How do you program a PSU? And how to program when these BPs are more complex than my example?

In addition, my implementation is very fragile. If you need to add some more process within the current BP, there will be even more conditions.

ps php tag, so I made this BP in php.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Daria Motorina, 2020-10-01
@Kirill-Gorelov

I remember that for similar situations you could use the State template . Its trick is that you can set a valid chain of states, and the state itself is encapsulated in classes

D
Dmitry Roo, 2020-10-01
@xez

That's what BPM is for.
For example: https://camunda.com/

D
Dmitry, 2020-10-01
@gebrak

The specified task can be quite conveniently implemented using the Symfony Workflow component https://symfony.com/doc/current/workflow.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question