wood burning stoves 2.0*
The moose likes Distributed Java and the fly likes Keeping Remote/Client Objects in Synch Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Keeping Remote/Client Objects in Synch" Watch "Keeping Remote/Client Objects in Synch" New topic
Author

Keeping Remote/Client Objects in Synch

Dave Brown
Ranch Hand

Joined: Mar 08, 2005
Posts: 301
Hi all, forgive me if I've not quite chosen the correct forum.. I think there's a few I could have chosen with this..

I'm having a play around at converting an existing JSF based web app into a thicker client based client server app, Where my UI will be based on Swing, and all business logic taking place on the Server, and being invoked with webservices.

I'm curious as to what the 'usual' practise is when tackling these type of projects with regard to keeping Objects in Synch... i.e. lets look at a User bean for example, is it normal practise to use the same 'User' bean java file in both my Server app source as well as the Desktop application source? Although there are Persistance annotations in the server version which obviously wouldn't need to be in the Desktop version as all database operations will be done on the server.

So before getting into this project, I'd love to hear what others consider best practice.

Thank you :-)



Regards, Dave Brown
SCJP 6 - [url]http://www.dbws.net/[/url] - Check out Grails Forum
Zohrab Basmajian
Greenhorn

Joined: Oct 27, 2009
Posts: 2
Where my UI will be based on Swing, and all business logic taking place on the Server, and being invoked with webservices


It's not good idea to place all your business logic on the server. The best practice is to divide your application into layers (presentation, serivce, business, data acess,..) layers and create a modular components to get benefit of loosely-couple.


I'm curious as to what the 'usual' practise is when tackling these type of projects with regard to keeping Objects in Synch... i.e. lets look at a User bean for example, is it normal practise to use the same 'User' bean java file in both my Server app source as well as the Desktop application source?


Yes, you want objects to keep it in Synch most of times and not to create duplicate objects on both client and server side. Best practice is to create value object or data transfer object that encapsulates objects based on your UI needs. Lot of times, you want to merge (comb box objects, model objects, etc..) into one value object and transfer it from servier to client and vice-versa. There are serialization/deserialization techniques you might want to use. However, lot of technologies provide those type of techniques. In fact, there are some annotation that you can place on server-side object and client-object to map them together.


Zohrab Basmajian
Software Engineer (Parasoft Corp.) - Service Oriented Architecture Solution
Sun Certified Java Programmer (SCJP)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Keeping Remote/Client Objects in Synch
 
Similar Threads
hibernate in desktop app
Application Design thoughts..
integration options for desktop applications
J2EE security through entire enterprise app
A little help defining my objects?