For Programmers: Free Programming Magazines  


Home > Archive > Java Beans > July 2006 > Design architecture problem. -- Java Beans / Controllers









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Design architecture problem. -- Java Beans / Controllers
chrismiles@blueyonder.co.uk

2006-06-24, 8:12 am

Sorry I posted this to comp.lang.java.programmer but I think I should
have put it in here... apologies for cross posting to both groups.

At the moment my system is split into the usual 3 layers -
presentation, business and data.

Presentation layer is composed of JSP and Servlets. My business layer
is session beans, and my data layer is entity beans.


Now take this scenario for example.


I have my servlet which invokes getAccount(accountId) on my session
bean, which in return locates a Account session bean.


It has been advised to me previously that is bad practise to let your
client (my presentation layer) get direct access to the entity beans.


Now how can I pass my information back to the presentation layer
without actually passing a entity bean? Am I best getting all the
information from the entity bean within my session bean and then
encapsulating in another standard class which I will then pass to the
presentation?


I know it is a design/arch issue but its really boiling me.


any help much apreciated. thanks in advance.

timasmith@hotmail.com

2006-07-07, 9:57 pm

I guess it depends.

If you value isolating tiers to separate concerns and reduce the impact
of changes with in your layers go with a denormalized copy of the data
sent to the presentation client.

If you value time to market and reduced complexity I would probably go
with JSP/Servlet manipulating Hibernate objects directly.

There is no right answer, each architecture has trade offs and you have
to weigh those against your business non-functional requirements.

chrismiles@blueyonder.co.uk wrote:
> Sorry I posted this to comp.lang.java.programmer but I think I should
> have put it in here... apologies for cross posting to both groups.
>
> At the moment my system is split into the usual 3 layers -
> presentation, business and data.
>
> Presentation layer is composed of JSP and Servlets. My business layer
> is session beans, and my data layer is entity beans.
>
>
> Now take this scenario for example.
>
>
> I have my servlet which invokes getAccount(accountId) on my session
> bean, which in return locates a Account session bean.
>
>
> It has been advised to me previously that is bad practise to let your
> client (my presentation layer) get direct access to the entity beans.
>
>
> Now how can I pass my information back to the presentation layer
> without actually passing a entity bean? Am I best getting all the
> information from the entity bean within my session bean and then
> encapsulating in another standard class which I will then pass to the
> presentation?
>
>
> I know it is a design/arch issue but its really boiling me.
>
>
> any help much apreciated. thanks in advance.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com