Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Keeping Remote/Client Objects in Synch

 
Dave Brown
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 :-)


 
Zohrab Basmajian
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic