samedi 1 août 2020

Java design patterns: Pipeline and immutability

I'm working on a lightweight framework for my backend services to support a pipeline-like processing.

  • In the pipeline, each stage is essentially a Function<IN, OUT> where IN is the OUT of the previous stage.
  • Each stage can set its result to the data model (let's call it Record)
  • Although the input is IN (the previous stage's output), each stage can look at all previous results so far.

My question:

So essentially, each stage can set its result to the data model and can get all other results so far. That makes the model being shared and mutable among all components in the pipeline.

Would it be considered an anti pattern? If so, what changes will you make in my architecture?

Thanks

Aucun commentaire:

Enregistrer un commentaire