Subrahmanyam Allamaraju on J2EE


News: Subrahmanyam Allamaraju on J2EE

  1. Subrahmanyam Allamaraju on J2EE (2 messages)

    Subrahmanyam Allamaraju is co-author of the popular "Professional Java Server Programming J2EE Edition", by Wrox Press, and an article contributor to In a recent interview, Subrahmanyam gives his thoughts on J2EE.

    Read the article here.
  2. Subrahmanyam Allamaraju on J2EE[ Go to top ]

    "business logic" and "persistence logic"

    Most OO conceptual issues arise when we classify Entity beans as meant for data and Session beans for business logic. In my opinion, this is a false representation. In projects that I have been involved with, we have successfully used Entity beans for essentially modeling business domain concepts and Session beans to map business domain processes.

    Think of it this way. If a valid Customer number is supposed to be 8 digits, then where should we enforce this ? My opinion is that the Customer Entity bean should enforce all rules that would make it an invalid Customer. In that case, is this "business logic" or "persistence logic" ? I think we erroneously categorize this as the latter. How about relationships between Entity beans ? Those are also business concepts and not "data" or "persistence" concepts. Should we be able to traverse Entity beans as defined by business concepts e.g. Customer has one or more Policies. In this case should the Entity bean Customer have a method getPolicies() that returns all its Policies or should that be done using a Session bean.

    If someone tells me that this kind of "business logic" should be restricted to a Session bean I would tend to argue that this is not OO !

    Additionally I would argue is that there is no other logic other than "business logic". Anything we program including things like transaction handling etc. is all based on business concepts and processes. We could not just make up those rules if we did not know the business rationale.

    All of the above is of course only an opinion. The bottom line is producing systems that accurately and efficiently solve business problems.

    Savio Lobo
  3. Subrahmanyam Allamaraju on J2EE[ Go to top ]

    I fully agree. Putting the business code that prevents an customer bean from being an invalid customer is what reinforces the "plug-and-play" concept of components.