Good or bad framework design? What do you think?


EJB design: Good or bad framework design? What do you think?

  1. The company I work for uses a business framework which another company creates for us.

    This framework is on top of EJB. Our company wants to code ERP programs with it. We use Eclipse, CVS, WebLogic and Oracle. The objects are persisted with CMP. Some objects will be persisted with serialization I heard recently.

    I am not convinced of the quality of that framework. Since I am unexperienced with J2EE, EJB and framework design, I want to ask you a few questions.

    1. The framework uses reflection very much. I think this is problematic because it decreases the performance, makes hard to understand how the framework works and bugs related to the use of reflection are difficult to find since they are not discovered at compile time.

    2. We use business objects. They are value objects like Article, PurchaseArticle and so on. There are only associations between the business objects and no inheritance is used for that purpose. Normally I would make a class PurchaseArticle extends Article. But I can't with the framework. Our business objects seem to reflect the need of relational databases since there is only association between them, no inheritence. What do you think: Is this a good or bad framework design?

    3. Our project leader wanted Domain Objects. Don't ask me what they are or why we call them so. I think it is a root business object with several other business objects connected to it. If one loads a Domain Object, all sub objects are loaded too by default. To me, it leads only to confusion without any positve aspect. Instead we should have used a load controller for this (or use EJB QL?). It leads to the fact that we cannot use CMR for Domain Object relations but need to use our own proprietary relation system: CR, contract relation. Because of that we will not be able to use EJB QL in my eyes. And whether an object is or should be a Domain Object or not depends on how you view it or in which context you need it.

    4. We have public getter methods in our framework which we are not allowed to use. They are multi language attributes like getName(). This method may not be called but the method getTranslation(Locale locale) instead. The same applies to setTranlation(String aspect, Locale locale, String text). There is no other way knowing if an attribute is multi language than by looking into the Javadoc. I would have expected methods like getName(Locale locale).

    5. The deployment is very complicated, time consuming and buggy. Also the connection between requested and provided services of the components takes a long time and the time will increase faster than CPU power increases because more and more components will be added.

    This is enough for now. What do you think about these points? We use a framework which is not finished at all. The people who make the framework don't get enough time to make it properly and they also don't have enough experience in my eyes.

    Threaded Messages (2)

  2. Reply[ Go to top ]


    1) Reflection in JDK 1.4 is not as slow as it was in previous versions of JDKs. Moreover, when you deal with CMP, application server uses reflection all the time, so the perfomance is definetely not an issue to worry about.
    Bugs is a different problem. But I reckon that the frequency of bugs mostly depends on the qualification and experience of the coders with specific technology being used, rather than on technology itself.

    2) Well, I don't see any reason that could stop me from introducing an inheritance into your framework, if you really need it. I can't say if it's bad or good design you have - that depends on what/when/how often you intend to use inheritance in this case.

    3) This one seems to be quite ridiculous. If the functionality of CMP doesn't satisfy one's needs, one could think of extending CMP to his/her needs rather than re-inventing the bicycle. Moreover, I hardly expect that one will find any crucial features to add to CMR/lazy loading logics of the latest Weblogic. Domain Object concept looks like nonsense to me.

    4) Moreover, I would recommend to use Resource Bundles for automatic substitution of all locale-specific strings and settings. I suppose RB logics can be easily integrated into your framework if needed.

    5) Try to automate your deployment process. Ant and Xdoclet could become of a great help for you. I recommend you to spend some time in coding Ant tasks specific for your project/framework - that will save a lot of valuable time in the future.

    The good main framework is at least 50% of the successful project. One of a System Architect level should devote a lot of time during Design phase to develop a good design for the main framework and after that only the best coders of the project should be involved into the development of the framework.

    You should always take into consideration the fact, that it's always a proof of bad design when one introduces any major changes to the framework code during Development phase of the project - this should be escaped by any means. The more universal your framework is - the better. Code once - run anywhere.

    Just my 2 cents - hope this donation helps.

  3. Reply[ Go to top ]

    Thank you very much! It helped a lot. I couldn't reply earlier. I hope you read it.

    I don't like to see reflection where it is not necessary. I removed it according to Joshua Bloch's recommendation wherever it is not necessary. Even with SDK 1.4, reflection is twice as slow as not using reflection. Reflection is good if it is used to solve certain problems.

    I think that bugs can be more likely if the design of the framework and the software development process is not good. Then even good programmers make more bugs. Plus we are not very experienced.

    Concerning inheritance I don't know how common it is for value objects (like Article) to be extended instead of being related to another value object. I have a strange feeling that our value objects are designed in order to be mapped more easily to a relational database.

    We already use Ant, but not Xdoclet. Infact I am not sure, because I don't know what Xdoclet is.

    The project leader wants to automate the process by letting the framework team code Eclipse plugins for the framework. I said that this is not a really good thing as long as the framework remains in a poor design.

    I think that my company underestimated how much know how and quality of a framework is necessary. It is a money problem of our company.

    Sometimes we search for days a bug. A framework has to be designed so that one can easily find a bug. Ours is obviously not designed like this. Recently I saw how stupidly the framework uses Exceptions. Besides this, exceptions occur very often while the Weblogic is up and started the framework. But they are supressed.

    I am curious what will become of our project.