This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • 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
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

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.

 
You have to be odd to be #1 - Seuss. An odd little ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!