Reputation: 2059
Assume there are several operations for 1: "Unzipping a a zip file", 2: "Setting some configurations" and 3: "Running the .exe file". Therefore there a a sequence of operations that should be execute one after another. I found out that one of the good pattern to do this, is "Command Pattern" but i scruple about it. Is there another patterns that may be more suitable doing this?
Upvotes: 0
Views: 179
Reputation: 441
You can actually follow a template pattern. http://en.wikipedia.org/wiki/Template_method_pattern. You can implement the same by creating a class say Job and having a main method called execute. This execute method intern calls three template methods each for your mentioned operation in a desired sequence.
This a flexible pattern, In a sense if later you would like to customize the configuration setup for one situation without affecting anything else, you can create a subclass of Job and just override one of the three template methods for setting up configuration, and it will work. Notice that there would be no changed required for main execute method, since the flow still remains the same.
Template method is often followed while designing frameworks, that allows users to override small functionality without tempering the whole work flow of the framework.
Upvotes: 1