• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Separating business logic in distributed systems

 
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi. I'm building a system such that I have a processing engine that does a lot of complex calculations and a user interface that can be used to access that engine. Typically, the processing engine will reside on a powerful machine while the interface might be on a separate machine (and use sockets or some distributed communications to communicate).

My question deals with tradeoffs of the model view controller pattern here. Just by the nature of the system I have a clear separation of logic and presentation. But, I'm wondering if I should be keeping a data "model" as part of the user interface software in addition to the processing engine (note the processing engine can retain state and is not just for straight calculations).

By maintaining this model, I may have some data duplication and storing state that may already be stored in the processing engine. But, I also don't want to have to query the remote processing engine if I don't need to. One particular issue that comes to mind is data validation. I don't want to send a message with invalid data to the processing engine remotely just to get a message back saying the data was bad. But, if I do validation on the client side, I have an issue if someone wants to use the processing engine without the client since the validation will not be there. Lastly, I also will end up some data duplication because I need to store state information that is in the processing engine just to do the data validation on the client.

I know this is a pretty long winded post, but any advice would be appreciated here.

Thanks,
Jeff
 
Sheriff
Posts: 67665
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Redundant data validation is common. I validate my data on the client in order to let users know immediately when data is invalid, but my server-side code never assumes that client-side validation takes place.

And of course, there are some validations that can only take place at lower levels and aren't checked at the client (authentication, for example).
[ June 15, 2008: Message edited by: Bear Bibeault ]
 
Rancher
Posts: 4686
7
Mac OS X VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A little redundancy is not bad. Never trust the client. Always validate the data, even if it appear redundant in the first release, you never know what sort of Web Service it will turn into, and then you must re-edit.

Plus, if the client is a browser, you can never trust the browser. Ever.
 
Jeff Storey
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks guys. That was my initial thought. Plus, I can probably reuse the data validation code anyway so it's still maintained well.
 
The only thing that kept the leeches off of me was this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic