1

In my current project, I have a screen which pulls data from several webservices, pulls data from database via backend API and checks that all resources have the same data or not.

The other webservices are partial mirrors of the data in the db and the screen shows a table with the state of the data(if everything is the same across the servers)

In the past the screen was entirely in client side javascript(all the rest calls, all the comparison logic) and later I moved most of it to the java backend that now expose json with the current state and the client side translate it to a table view

However, I am not very satisfied with this.

JS pros:

  • Smaller code.
  • Easier to implement

JS cons:

  • More fragile,vulnerable to simple changes in the webservices
  • Business logic and presention tangled together
  • Uglier code
  • Client code knows to much about the data structure

Java backend pros:

  • More readable
  • More decoupled

Java cons:

  • Much more complex, a lot of classes(dtos for example)
  • Java don't go nicely with json
  • Harder to implement
  • Harder to implement some features because of abstractions

What is the right approach? Client or server?

4
  • 7
    You have asked pretty much the same question recently and I gave you an answer here.
    – Andy
    Commented Jun 26, 2016 at 18:36
  • correct, but I am not sure I still understand that, thus I asked that again. Commented Jun 26, 2016 at 19:10
  • 3
    You can just comment under the answer for further explanation of things you didn't understand, rather than create an identical question. I would be willing to edit my answer to provide more information, but I need to know what exactly you did not understand.
    – Andy
    Commented Jun 26, 2016 at 19:55
  • 2
    The only possible answer to the question "client side or server side" is "whichever way best meets your software's requirements." It could be a combination of both. Commented Jun 26, 2016 at 22:58

1 Answer 1

3

I do like David Packer's answer on your other question. But to distill it a bit more:

  • Some Business Logic on front end to reduce round trips.

  • But all Business Logic on back end (which, yes, means you will have duplicated business logic)

Also, forget about how difficult or not is to implement it on a language. You are taking an architectural decision independent of the language (you could use different languages if the difficulty to implement it is of actual concern to you).

Not the answer you're looking for? Browse other questions tagged or ask your own question.