7

Why do we need special software like Uber's Cadence or Camunda or Activiti? If it's just a sequence of tasks then why can't we just code it? I've trying to read Camunda and Cadence's docs and just can't get into it. My company wants to use. The senior dev who thought about it can't/won't seem to explain why or where he wants to use it.

And I find their code / way of setting up workflows very unintuitive. Somebody please help.

The project is developed using Java and Spring Boot.

Zàf Mohammed
  • 127
  • 1
  • 9

2 Answers2

10

What do you mean by "just code it"? Ok let' look at the following code:

String r1 = task1(someArg);
String r2 = task2(r1);
if (r2.equals("foo")) {
   sleep(Duration.ofHours(5));
   task3(r2);
} else {
   task4(r2);
}

Now go and "just code" it to be scalable and fault-tolerant (for example against process failures while task2 is being executed) and be robust for long downtimes of any of those task implementations. I bet your code will a buggy mess of callbacks and database calls.

Temporal Workflow allows writing such code and makes it fault-tolerant without any large modifications.

Maxim Fateev
  • 6,458
  • 3
  • 20
  • 35
8

It could take a book to answer the question. A few aspects:

  • Communication between business and IT
    You cannot show code to the business, but people understand BPMN diagrams. At least the basics set of symbols is quite intuitive (http://bpmn.io/ or https://www.omg.org/spec/BPMN/2.0/About-BPMN/#documents) . Where Would you start explaining the logic of your coded workflow to a business analyst? And how do you translate the feedback regarding the business rules into code?
    If requirements are not well translated into the target system then you get additional iterations and effort. BPMN diagrams can be interpreted by a process engine, so there is no mismatch between the operational process discussed with business and the process executed.

  • Flexibility / separation of concerns
    A process model reflects the business logic and allows you to separate it from the code. By not burying it in the code the business logic becomes easier to understand (see previous paragraph) and change. It can also be versioned independently. The lifecycle of business rules, process logic and other (e.g. integration) code is frequently very different. Faster changes to IT systems means improved business agility.

  • Transparency
    The workflow engine ootb monitors the status and collects all the (frequently mandatory) audit data. Where are we in a specific process execution? Why is it not progressing? Who performed which step and when? How long did it take? Which data was changed?
    Based on this data you can generate reports (average processing time of your bank account opening process over the last 12 months?) and analytics (risk to lose the customer given certain circumstances?)

  • Standardized features which you would have to program
    Would you develop you own database? No, then why would you develop your own workflow management? State management, work assignment (user, roles, groups), permission concept on tasks and data, logging of audit information, error handling, thread management, retries, standard reports,....

I could go on, but this should give you an idea. Further reads could be:

https://thenewstack.io/5-workflow-automation-use-cases-you-might-not-have-considered/

https://blog.bernd-ruecker.com/the-microservice-workflow-automation-cheat-sheet-fc0a80dc25aa

https://www.ecosia.org/search?q=why+workflow+engines

rob2universe
  • 7,059
  • 39
  • 54
  • Thank you for a thorough explanation on WHY, I shared your answer to our team for some additional understanding. We are currently building fin tech product. As an MVP, we coded all "plumbing" logic by ourselves. "The usual approach to building such applications is a hodgepodge of stateless services, databases, cron jobs, and queuing systems..." - Cadence website described it best. Now we need to pick a workflow engine. If you have any guidelines on how to pick one, I would greatly appreciate that. – AzaFromKaza Feb 13 '22 at 10:03
  • 1
    Consider https://blog.bernd-ruecker.com/the-process-automation-map-1abe2d79192b / https://blog.bernd-ruecker.com/exploring-the-process-automation-map-7d9aa181a747 As you can tell from my response I am a fan of the business IT alignment achieved with BPMN2. If you look for products, which can perform process orchestration lightweight, highly scalable, use BPMN2 and are open, then your choice is narrowed down to 2-3 products. – rob2universe Feb 14 '22 at 01:37