2 Replies Latest reply on Aug 18, 2008 10:16 PM by Khosro Asgharifard Sharabiani

    Design Patterns

    Balvindar Dhaliwal Newbie

      Hello,


      Please advise on common seam web design patterns. Most seam examples I have read, tightly bind the jsf page to a backing bean which is stateful or stateless. The backing bean does most of the business logic, interating with database and entity objects. This is alot of work for the backing bean to do. What about having a session facade or service locator that looks up services that will be responsible for doing business logic. This layer would inject EAO and process entity beans to carry out the business logic. The backing bean would be responsible for setting page attributes and validation and delegate business logic to the session facade/service layer?


      Thanks,
      Balvindar

        • 1. Re: Design Patterns
          Diego Coronel Apprentice

          Hi balvindar,


          You can use any design pattern in your seam application, but you should be carefull with excessive bijection. Seam makes injection and outjection for each method you execute. So, if you make a Facade with lots of EAO injection you can slow your application. In my system i did some classes that i call BusinessRules(for some common rules in my system), EAO, Factory (using Seam Factories annotation) and my backing beans injecting only the necessary. I did a EJB project with all these classes and a war project with backing bean and web components.


          Sry about english.

          • 2. Re: Design Patterns
            Khosro Asgharifard Sharabiani Newbie

            Hello Diego and Balvindar,


            The following quote is from jsfcentral.com(Title is:David Geary discusses JSF, Ajax, and GWT)



            Essentially that’s all you have, beans and views. Seam collapses all the traditional layers that you have to deal with like the DTO layer and the database layer. It collapses all those down essentially into just beans and views. On the other hand, it doesn’t prevent you from having those layers. If you want to have multiple layers you can do that, but by default we just have a very simple component model where we have beans and views, and it makes development much simpler with Seam, much easier to do

            Diego,i wanted to avoid excessive bijection,but i got the error that i have described here:
            (Please look at the last post)


            http://www.seamframework.org/Community/PleaseHelpInAttributeRequiresNonnullValue



            Would you please describe more that what you did about avoiding excessive bijection?(Maybe with examples).


            Thanks.


            Khosro.