I am working on refactoring my project to use Spring. Currently I have the following standard setup:
As I am pondering how to go about refactoring, the "normal" way to convert this would be to do this:Code:Remote Native Client JBoss | |------------------| | | Web Client | | | | | |--------RMI-------> | Session Beans | | | | | Entity Beans | -------------------- | DB
But what I am wondering is: why do I even need to continue to access my business logic remotely from my remote native client? What is it about the GUI talking through the web tier that is so essential? The business logic is essentially an API of "static" methods that only change the state of the DB, not the business objects.Code:Remote Native Client Tomcat | |-------------------| | | Web Client | | | | | |---Hessian or-----> | BizLogic POJOs | HttpInvoker | | | | Hibernate | --------------------- | DB
Why couldn't we have the following: the business logic will be
written once, but "deployed" in two ways: for the native app, it will be
compiled into the jar that runs natively. For the web app, the same code
will be compiled into the war that is deployed to the web server.
For me, the grand purpose of having a layered / tiered architecture is codeCode:Remote Native Client Tomcat |-----------------------| |-------------------| | UI Code (SWT) | | Web Client | | | | | | | | BizLogic POJOs | | BizLogic POJOs | | | | | | | | Hibernate | | Hibernate | ------------------------- --------------------- \ / DB
maintainability. A good architecture means less redundancy, more cleanly
defined classes, etc. This would be accomplished even without the web
server exposing the business methods to a remote native client.
The only issue I can see is that there may be caching issues with
hibernate. Nevertheless, even if we turn off caching, the speedup from
not having to remote our objects would most likely be well worth it. There are other benefits too: not remoting means no more DTO's (can just use Hibernate lazy-loaded objects and have a much more fine-grained API), and I wouldn't need to worry about securing my remotely accessible API.
What do you all think?


Reply With Quote