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?