Design pattern for similar processing steps, but with slight variations
What is a good design pattern to implement a feature, where processing of data is pretty similar, except for variations in may be few steps... I initially thought that Chain-Of-Responsibility may be suitable... but it doesn't feel like the right choice.. If I'd know the name of appropriate pattern, I'd search it on internet.. but I don't know what pattern to use here.. So please suggest one. To be clear with an example - Scenario 1 Step 1 Step 2 Step 3 Step 4 Scenario 2 Step 1 Step A Step 3 Step 4 Would like to implement the feature in such a way that minimum code duplication is necessary. I do realize that something will have to chain the necessary steps together at the start, like a factory, based on the scenario.
What you've described may be solved by pipelining, where a set of steps are linked together to pass data through a "pipeline". There are different means of accomplishing this in different languages, but here is an example with data flow pipelining in .NET (C#): http://msdn.microsoft.com/en-us/library/ff963548.aspx and an alternative in Java using Apache Commons: http://commons.apache.org/sandbox/commons-pipeline/pipeline_basics.html
From your example it seems to me that Template pattern would be more appropriate when sequence/steps are always the same but one or more steps has different implementations. In case number of steps variate much more, for example completely different step order, sometimes just few steps sometimes some steps are skipped than Strategy pattern would be better solution. However if you need to apply different rules after another (like graphics filters) on a object than pipeline would be more appropriate. As soon as one "filter" finishes you give the object to the next one in the pipeline
Combo box autocomplete blanks when down key pressed C# windows
XNA 4.0.4 use Z-buffer in rendertarget
IP/name resolve conflict
Sort a List based on a Pre-Sorted List
Constructing an enum instance [duplicate]
Cant access C# static class
MVC 5 not validating StringLength attribute properly
How do I bind an ObservableCollection to an AvalonDock DocumentPaneGroup?
Get concrete property that implements type
ASP.NET website and ms excel integration
Call a C# .net .dll script using PHP
Invalid PDF digital signature in WinRT app
Coordinate API OAuth2 authentication with refresh token
SELECT ##IDENTITY in Access always returning 0
C# Wpf Visual Studio Meaninglessly Insists My Class Does Not Exist In Namespace
Change the default TaskFactory?