Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PetStore StateMachine

 
Gerald Davis
Ranch Hand
Posts: 872
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have been looking at Sun�s Pet-Store example source code for better understanding of EJB design. The code has a class called StateMachine, which controls events to and from the ejb-tier. I have been wondering why they have chosen to implement StateMachine as a field in class EJBControlLocalEJB instead of inheriting functionality from it. I think that inheritance would have made the design simpler.
Also the StateMachine takes in ejb.SessionContext as an argument in the constructor.I don�t think this is necessary. Example

public StateMachine(EJBControllerLocalEJB ccejb, SessionContext sc){
..bla ..bla
}
I think a better way of doing it would be
public StateMachine(EJBControllerLocalEJB ccejb){
ejb.SessionContext sc = ccejb.sessionContext;
}
Sun probably has a good reason to do things this way I am just dying to now why.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic