2 Replies Latest reply on May 6, 2002 11:53 PM by Tiago da Costa Peixoto

    Single entry point design problem

    Abid Newbie


      Im working on an ejb application containing more than 20 entity beans and so. The design is such that there is a stateful session bean, say FullA, used as an entry point. FullA contains a single object of another stateless session say, LessA. This LessA has objects of all entities. It has been designed this way to reduce the number of objects in the session. Since LessA is a stateless session, no matter how much objects it has. Now you might have anticipated what the problem is. A thing here that bugs me is that no of lines of code in LessA now exceeds 2000. I know its not good to have that much code in a single class but situation makes it mandatory.

      A solution that im thinking about is that i should break down the LessA into LessA1, LessA2,.... depending upon the nature of entities it's referring to. You know doing it this way will increase the number of LessAxx objects contained in the FullA. Because im instantiating the LessAs in ejbCreate method of FullA. One solution may be that I dont instantiate anything until the method call. And within the method i lookup the entity and instantiate it.. So any suggestions..?

      Thanks in advance,


        • 1. Re: Single entry point design problem
          Deepak U Pai Newbie

          Rule of Thumb:

          If a design patter does not work to solve a problem - its a wrong design pattern. As far as being your class to big - remember if you put in your code into any other class it would not reduce the number of lines your session object to execute.

          However - if you reexamine the design of your classes itself and see if OOAnal and OODesign could solve what you cannot it might be more helpful.


          • 2. Re: Single entry point design problem
            Tiago da Costa Peixoto Newbie

            Well, you could keep the LessA and do create the LessA1, LessA2 and so on. Then you have only one association among FullA and LessA. And LessA associates with LessA1, LessA2, ..., according to the nature of entities it´s (LessA1, A2, ...) referring to. So LessA will be used to join these others Lesses, but won´t have intelligence. By this way, the 2000 lines of code will be distribute to LessA1, LessA2,.., wich has the intelligence presented in the old LessA. The new LessA will only "call" the services of the other Lesses (LessA1, LessA2, ...).

            Best Regards!

            (Sorry my english. It´s not so good).