Search code examples
c#tpl-dataflow

Should I use TPL Dataflow to fight against complexity if there is no concurrency?


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?


Solution

  • 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.