Web-development – business logic: client-side vs. server side

Architecturedesignweb-development

Let's say 3-5 years ago (more or less) n-tier application on the server side – and some javascript/html/CSS for the UI was a basic approach for web development.

Nowadays we can see that traditional web development paradigm changes a lot. Each day I saw more and more application who do not have server side in traditional way. They just consume some services (data-service, auth-service, etc.) but the business logic placed on client side. Also already a lot of javascript frameworks creates for simplify development according such model (Angular, Backbone, etc.)

What are the main benefits and disadvantages of new model versus traditional approach?

Best Answer

There are several advantages to this approach:-

  • Responsiveness, because the business logic is in the fat client you do not need to wait for a round trip over the network for every interaction.
  • Sophistication - having all the control and higher level logic in the client enables rich user interfaces (e.g. this site, or gmail) which would simply not be possible if every interaction required a round trip to the server.
  • Scalability, all this processing is taking place on your device, using your electricity. if you have a large number of users the saving in server side processing is significant.

There are a few downsides though.

  • Lack of control over the client environment. You do not know which browser on which OS or what screen size and processing power your client will have. You application may not work on every client.
  • Uneven response. Large client libraries need to be downloaded and upgraded every now and then which will be relatively slow, once downloaded the response is lightning fast, users, generally prefer a consistent response time even if it is a little slower.
  • Javascript -- love it or hate it you are stuck with it as your main development language. Your code becomes public which some companies hate (perhaps they are embarrassed by their code quality?).
  • Security -- your server side code is now largely just database services whose APIs are open to anyone studying your Javascript therefore you need to take extra care in securing these services.
Related Topic