 <p>You can use Command Design Pattern</p> <p>for more info :</p> <p><a href="https://en.wikipedia.org/wiki/Command_pattern" rel="nofollow">https://en.wikipedia.org/wiki/Command_pattern</a> <a href="http://www.tutorialspoint.com/design_pattern/command_pattern.htm" rel="nofollow">http://www.tutorialspoint.com/design_pattern/command_pattern.htm</a></p>