locked
Pattern wanted, RRS feed

  • Question

  • Proven pattern wanted! Preferably API available for .net.

    I want to calculate item A, that has calculation results from B and C as a prerequisite. While B can be immediately calculated, C in turns need calculation results from D. D can be immediately calculated.

    I was thinking about putting all this into a bucket and then iterate the bucket, calculating everything that has its prerequisites in place, until all items are being calculated. Then, before setting out doing this, using the wrong type of queue and stuff, I thought that some pattern savvy could point me in a direction of a proved pattern for handling this kind of problem.

    Longer explanation of inner workings:

    A is placed into bucket and tried calculated. A has B and C as prerequisites and therefore A puts B and C into the bucket as well. Reiterating causes B to finish calculating while calculation of C triggers C to put D into the bucket as D is a prerequisite to C. Reiterating causes D to calculate (as it has no prerequisites) and now at next iteration C can be calculated and then at last A.

    Tuesday, August 4, 2020 12:01 PM