I have a project that has blocks of a workflow semantically. The solution does not involve any concurrency or CPU bound operations nor scalability is required. I just have an input and it is processed and passed through the pipe line of blocks. Each block process the item and makes a decision and passes it to next block. In order to fight against complexity,is it okay to use TPL Dataflow, or would it be an overkill since there is no concurrency and I should use regular OOP tactics ? In other words, is TPL DataFlow right tool for this job?
Asked
Active
Viewed 304 times
1
-
Regarding this ==> *"The solution does not involve any concurrency"*, do you mean that concurrency is unneeded or unwanted? Because when you have more than one TPL dataflow blocks linked together, you have natural concurrency since the output of the first block is processed by the second block, while the first block is concurrently processing a new input value. To avoid concurrency in a pipeline you must take specific measures, like configuring each and every block with the same `ConcurrentExclusiveSchedulerPair.ExclusiveScheduler`. – Theodor Zoulias Jun 26 '20 at 17:15
-
Looking back after many years later, I have switched to the functional programming paradigm and use Haskell Arrows (in F# though) for this task. When concurrency involved, I am using akka.net streams instead. – Onur Gumus Jun 29 '20 at 09:18
-
Hi Onur. I haven't played much with Akka.Net, and so I don't know how it compares to TPL Dataflow. If you have hands-on experience and an opinion to share, I would be happy to read it! [Here](https://stackoverflow.com/questions/39263257/what-is-the-difference-between-tpl-dataflow-and-akka-net) is a relevant question where you could share your opinion if you want. – Theodor Zoulias Jun 29 '20 at 14:22
1 Answers
2
DataFlow is for exactly the factors that you don't need ("The solution does not involve any concurrency or CPU bound operations nor scalability is required"
).
What's wrong with a chain of methods?
var input = ...;
var result1 = F1(input);
var result2 = F2(result1);
var result3 = F3(result2);
return result3;
What you have described is so simple that I don't see a need to do anything more. In particular it is unclear (yet possible) that OOP is a match. You have not described objects or data. You have described a process which maps to code, not objects.

usr
- 168,620
- 35
- 240
- 369
-
2You are right. I have an habit of over engineering things sometimes . Needed a second opinion. Thanks. – Onur Gumus Jun 20 '16 at 12:56
-