Search code examples
asp.netrubyalgorithmdesign-patternsstrategy-pattern

Iterating through strategy design pattern


I have a list of algorithms that I want to run on a dataset. For example, say my dataset is a list of addresses. I need to check the validity of the addresses but I have several different algorithms for validating. Say I have validation_one and validation_two. But in the future I will need to add validation_three, validation_four, etc. I need ALL of the validations to run on the address list, even the new ones when they get added.

Is there a design pattern that fits into this? I know strategy is for selecting an algorithm but I specifically need a way to apply all the algorithms on the dataset.


Solution

  • This sounds like the Chain of Responsibility where all handlers in the chain accept the request and pass it to the next handler.