Popular Posts

Design Patterns in WCS







  • MVC Design Pattern               
    Model View Controller pattern is used to separate the business logic from its presentation. View corresponds to JSP's, Controller corresponds to struts framework/BOD framework and Model corresponds to all back end objects used for processing like Accessbeans/EJB’s.

     
  • Factory Design pattern
    A factory pattern can be used to create an object of any one of sub-classes depending on the input data provided. This is used when we call another command from a command.
    Eg., SampleCmd sampleCmd = (SampleCmd) CommandFactory.createCommand("com.test.commands.SampleCmd",getStoreId());

  • Command Design Pattern
    It is used to execute a command with a blackbox view of it. The “command” is a black box to the “client”. All the client does is call “execute ()” on the opaque object.
    Eg,. sampleCmd.execute();

  • Display Design pattern
    In WCS, view names are used to display the response (JSP) to the client. There may be a need to pass different response based on clients.
    E.g., <forward className="com.ibm.commerce.struts.ECActionForward" name="SampleView/10161/-22" path="/test/SampleView_View1.jsp" />


  • Singleton Design pattern
    A singleton pattern ensures that only one object instance is created by the JVM at a time for a class, which is taken care by the out of the box framework. Eg. ECCommandTarget class

No comments:

Post a Comment