How can the patterns be applied to a Functional Calculator application, where a mathematical equation needs to be created, modifed and executed when the parameter values are made available? Seems like this requires mixing Strategy, Visitor, Interpreter patterns... Has anyone tried this kind of an application? Can you suggest the best suited pattern(s) for a Calculator? Thanks in advance.
Desai Sandeep
Ranch Hand
Joined: Apr 02, 2001
Posts: 1157
posted
0
Hi, I am not sure of about the patterns you mentioned, but I think the Command Pattern might be helpful in this case. You can have a Command Interface for say Mathematical functions with an execute() method.The GUI Presentation class would pass the Command to the Controller, which would create a Command instance corresponding to the event message forwarded.There would be a Command class for each type of possible Mathematical command/function.This class would override the execute() method polymorphically which is defined in the Command interface. Hope this makes sense. Sandeep
<b>Sandeep</b> <br /> <br /><b>Sun Certified Programmer for Java 2 Platform</b><br /> <br /><b>Oracle Certified Solution Developer - JDeveloper</b><br /><b>-- Oracle JDeveloper Rel. 3.0 - Develop Database Applications with Java </b><br /><b>-- Object-Oriented Analysis and Design with UML</b><br /> <br /><b>Oracle Certified Enterprise Developer - Oracle Internet Platform</b><br /><b>-- Enterprise Connectivity with J2EE </b><br /><b>-- Enterprise Development on the Oracle Internet Platform </b>