• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

Keeping Remote/Client Objects in Synch

 
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 :-)


 
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.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic