Command Pattern or Session Facade/Business Delegate??


EJB design: Command Pattern or Session Facade/Business Delegate??

  1. Hi folks,
    There would be no argument if i say for bigger projects session facade and business delegate combination would be a better bet than command pattern framework.

    Talking about medium sized and the below ones, the only two advantages i can see from Command pattern is that:
    1. Changes to the usecase logic will keep your session facade methods stoic. since, we just pass the command object as a parameter and therefore, anychanges to the parameters and return values, would affect the command object alone and nothing else.

    2. They are very lightweight when compared to session facade option.

    But then, talking about the first advantage, even in the case of SF/BD combination, can we not bring that neutrality by having a hashmap as a single input parameter and return value. By doing this way, the changes in usecase logic, will shield the session facade.
    Or, do we have any serious performance hiccups, by doing it this way?

    And, talking abt the second advantage, how does command pattern fair as far as serialization goes, if the usecase logic is running into several lines of code.

    Is it advisable to go for SF/BD if the use case logic is too complicated and lengthy, so that the entire logic always stays in the ejb's jvm and doesnt get serialized or shuttled from the client's jvm to ejb' jvm everytime.

    Hope, the doubt is clear!!

    So, finally my understanding is that, command pattern is a good bet, if the usecases are not all that complicated AND the project overall is medium and less.

    For all other purposes, SF/BD seems to be better!!


  2. i hit the same wall in the last project, where usecases keep changing every couple days, and i found out using both SF/BD + CommandBean is a good choice since all the things i need to change are within the CommandBean. Imagine you put all ur usecases codes within the session facade. you will end up stacking up codes in it... i think the power of CommandBean is more valuable.

    have anyone tried the CommandServer in websphere?...
  3. But then, how heavy will it be serializing those heavy usecase logics over the network, if it is implemented in command beans?