jeudi 5 mars 2015

Managing hierarchical tasks with module/mediator/facade pattern

Say I've got a very intensive programatic task to complete, big task, which can broken down into smaller well-defined sub-tasks:



  • big task

    • small task 1

      • tiny task 1

      • tiny task 2

      • ...



    • small task 2

      • ...



    • ...




Each sub-task takes data from the parent task, runs the relevant calculations, and then returns the result to the parent, and so on through the tree until big task is completed.


I'm still learning about the module/mediator/facade pattern, but as far as I understand, the architecture would look like this:


Hierarchical module/mediator/facade setup


Parent tasks would publish instructions (which sub-tasks hear), and sub-tasks would publish their results on completion (which parent tasks would hear).


Is my understanding correct? Addy Osmani's explanations have been immensly helpful, but he doesn't talk too much about modules that are for complex series of calculations. Maybe there's a better design pattern for this type of project? Thanks.


Aucun commentaire:

Enregistrer un commentaire